CLI commands
Other checks and repairs
These are the remaining checks and repairs openclaw doctor performs, beyond the
postures and maintenance modes documented on the other pages.
Modes and prompting
- In Nix mode (
OPENCLAW_NIX_MODE=1), read-only doctor checks still work, butdoctor --fix,doctor --repair,doctor --yes, anddoctor --generate-gateway-tokenare disabled becauseopenclaw.jsonis immutable. Edit the Nix source for this install instead; for nix-openclaw, use the agent-first Quick Start. - Interactive prompts (keychain/OAuth fixes, etc.) only run when stdin is a TTY and
--non-interactiveis not set. Headless runs (cron, Telegram, no terminal) skip prompts. - Non-interactive mode skips prompts, not full provider-catalog or runtime-tool validation. Built checkout runs reuse available compiled plugin entries for these checks; intentional source overrides still execute source. See Development debugging.
--lintis stricter than--non-interactive: always read-only, never prompts, never applies safe migrations. Usedoctor --fixordoctor --repairwhen you want doctor to make changes.- Doctor does not execute
execSecretRefs while checking secrets by default. Use--allow-exec(with or without--lint) only when you intentionally want doctor to run those configured secret resolvers.
Config writes and backups
- Any config write (including a
--fixrepair) rotates a backup to~/.openclaw/openclaw.json.bak(with a numbered.bak.1...bak.4ring).--fixalso drops unknown config keys reported by schema validation, listing each removal; it skips this while an update is in progress so partially written upgrade state is not stripped before its migration finishes. - If
openclaw.jsoncannot be parsed and no last-known-good config can be recovered,doctor --fixleaves the file unchanged and exits with an error instead of writing a partial replacement. The error points toopenclaw config validatefor the exact parse position and explains how to edit or regenerate the config.
Gateway and service repairs
- Set
OPENCLAW_SERVICE_REPAIR_POLICY=externalwhen another supervisor owns the gateway lifecycle. Doctor still reports gateway/service health and applies non-service repairs, but skips service install/start/restart/bootstrap and legacy service cleanup. - Doctor reports the managed Gateway's applied heap limit and the adaptive derivation used for the current host or container memory limit. Use
openclaw gateway statusfor the same report outside a repair pass. - Doctor and
openclaw gateway statusskip systemd content repair advice when the manager reports a masked or otherwise unloaded unit. Loaded-unit checks, readable-file fallback after a failed manager query, and unrelated backup or credential diagnostics remain active. - On Linux, doctor ignores inactive extra gateway-like systemd units and does not rewrite command/entrypoint metadata for a running systemd gateway service during repair. Stop the service first, or use
openclaw gateway install --forceto rewrite the managed base unit. If a systemd drop-in overridesExecStart=orWorkingDirectory=, inspect it withsystemctl --user cat <unit>.serviceand update or remove that drop-in yourself; reinstalling the base does not replace it.Environment=drop-ins remain supported. doctor --fix --non-interactivepreserves the installed gateway service definition, including during update repair. Runopenclaw gateway installfor a missing service, oropenclaw gateway install --forcefrom the intended installation to replace its launcher and managed environment.
Session state and cron
- State integrity checks detect orphan transcript files in the sessions directory. Archiving them as
.deleted.<timestamp>requires interactive confirmation;--fix,--yes, and headless runs leave them in place. - Doctor scans historical
~/.openclaw/cron/jobs.jsonstores and previously configured legacy store locations for old cron job shapes, imports jobs and quarantine records into SQLite, and archives the migrated JSON files. - Doctor reports cron jobs with an explicit
payload.modeloverride, including provider-namespace counts and mismatches againstagents.defaults.model, so scheduled jobs that do not inherit the default model are visible during auth or billing investigations. - Doctor reports cron jobs still marked in-flight (
state.runningAtMs), which can makeopenclaw cron listshow them asrunning. This check is read-only: if no Gateway is currently executing a marked job, the next cron service startup records the interrupted run and clears the marker.
Tool and channel policy
- Doctor reports legacy image-inspection policy entries named
image.openclaw doctor --fixrewrites supported config allow/deny surfaces and persisted automationtoolsAllowentries toview_image; old-only wildcard patterns such asimage*are preserved and gain an explicitview_image, while patterns that already cover both names remain unchanged. Runtime exposes only the canonical name. - On Linux, doctor warns when the user's crontab still runs the unmaintained legacy
~/.openclaw/bin/ensure-whatsapp.sh, which can misreportGateway inactivewhen cron lacks the systemd user-bus environment. - When WhatsApp is enabled, doctor can report Gateway pressure and detected local TUI clients. These observations do not identify the cause or connect a client to that Gateway. Inspect Gateway diagnostics before deciding whether to close clients; Doctor does not stop them.
- When HTTP(S) proxy environment variables are present but
tools.web.fetch.useTrustedEnvProxyis disabled, doctor explains thatweb_fetchstill uses direct routing, runs a short direct TLS connectivity probe, and names the explicit opt-in. It never enables proxy trust automatically.
Models and auth
- Doctor rewrites legacy
codex/*andopenai-codex/*model refs to canonicalopenai/*refs across primary models, fallbacks, model allowlists, image/video generation models, heartbeat/subagent/compaction overrides, hooks, channel model overrides, cron payloads, and stale session/transcript route pins.--fixalso merges legacymodels.providers.codexandmodels.providers.openai-codexconfig when safe, migrates legacyopenai-codex:*auth profiles andauth.order.openai-codexentries toopenai:*, moves Codex intent onto provider/model-scopedagentRuntime.id: "codex"entries, removes stale whole-agent/session runtime pins, and keeps repaired OpenAI agent refs on Codex auth routing instead of direct OpenAI API-key auth. - Doctor also repairs retired model names in preferred media selections and converts CLI-encoded model references across fallback lists, model maps, media slots, and session provider/model pairs. Migrated agent selections keep per-model runtime choices; explicit canonical runtimes and session runtime overrides win. Canonical entries win collisions while missing nested settings are retained. These reference repairs preserve account pins, custom namespaced model IDs, and session bindings.
doctor --fixmoves the old Claude-only conversation ID into the provider-keyed session binding before removing the old field. Existing bindings and their resume metadata take precedence. Empty or ambiguous bindings stay saved with a reconciliation warning while safe sessions migrate. When Doctor clears stale Claude routing state outside the configured route, it also clears the old field so migration cannot restore that conversation. Run this repair after upgrading before resuming sessions that only have the old field; runtime lookup and normal saves use provider-keyed bindings.doctor --fixmigrates retired auth provider and profile identifiers in existing shared and agent SQLite stores, as well as legacy JSON imports. It preserves credentials and account metadata, uses unused profile IDs for collisions, and updates config references and rotation state together. Existing migration receipts retain verified account mappings across an interrupted store pass or failed config write; a changed account is not adopted on retry. Explicit empty config orders stay empty. Unreadable stores and unresolved credential realms remain unchanged with diagnostics; independent safe stores can still migrate.- Doctor reports nonempty
auth.order.<provider>lists whose referenced profiles are all gone while compatible stored credentials exist.doctor --fixdeletes only those stale overrides, restoring automatic per-agent credential selection; explicit empty orders, partially live lists, and orders without a compatible stored credential stay unchanged. If an active SQLite auth store is unreadable or malformed, doctor explains why it skipped this repair. Restart a running Gateway before rechecking auth status if its config reload mode does not apply the write automatically.
Plugins and skills
- Doctor preserves legacy shared plugin-runtime caches that another installation or profile may still use and removes only genuinely dangling plugin-runtime symlinks. It relinks the host
openclawpackage for managed npm plugins that declare it as a peer dependency. It also repairs missing downloadable plugins referenced by config (plugins.entries, configured channels, configured provider/search settings, configured agent runtimes). During package updates, doctor skips package-manager plugin repair until the package swap completes; rerunopenclaw doctor --fixafterward if a configured plugin still needs recovery. If a download fails, doctor reports the install error and preserves the configured plugin entry for the next repair attempt. - Doctor repairs stale plugin config by removing missing plugin ids from
plugins.allow/plugins.deny/plugins.entries, plus matching dangling channel config, heartbeat targets, and channel model overrides, when plugin discovery is healthy. - Doctor quarantines invalid plugin config by disabling the affected
plugins.entries.<id>entry and removing its invalidconfigpayload. Gateway startup already skips only that bad plugin so other plugins and channels keep running. - Doctor removes the retired
plugins.entries.codex.config.codexDynamicToolsProfile; the Codex app-server always keeps Codex-native workspace tools native. - Doctor auto-migrates legacy flat Talk config (
talk.voiceId,talk.modelId, and friends) intotalk.provider+talk.providers.<provider>. Repeatdoctor --fixruns no longer report/apply Talk normalization when the only difference is object key order. - Doctor includes a memory-search readiness check and can recommend
openclaw configure --section modelwhen embedding credentials are missing. - Doctor warns when no command owner is configured. The command owner is the human operator account allowed to run owner-only commands and approve dangerous actions. DM pairing only lets someone talk to the bot; if you approved a sender before first-owner bootstrap existed, set
commands.ownerAllowFromexplicitly. - Doctor reports an info note when Codex-mode agents are configured and personal Codex CLI assets exist in the operator's Codex home. Local Codex app-server launches use isolated per-agent homes; install the Codex plugin first if needed, then use
openclaw migrate plan codexto inventory assets that should be promoted deliberately. - Doctor warns when skills allowed for the default agent are unavailable in the current runtime environment (missing bins, env vars, config, or OS requirements).
doctor --fixcan disable those unavailable skills withskills.entries.<skill>.enabled=falseand lists the changes without asking you to repeat the repair. Updater-driven repair leaves optional skill enablement unchanged. Install/configure the missing requirement instead if you want to keep the skill active.
Sandbox
- If sandbox mode is enabled but Docker is unavailable, doctor reports a high-signal warning with remediation (
install Dockeroropenclaw config set agents.defaults.sandbox.mode off). - Doctor identifies per-agent
agents.entries.<id>.sandboxDocker, browser, and prune overrides ignored under shared scope. It also warns when an agent's explicit primary model omits fallbacks and therefore disables the defaults' fallback chain; both diagnostics use canonical agent paths after legacy roster normalization. - If legacy sandbox registry files or shard directories are present (
~/.openclaw/sandbox/containers.json,~/.openclaw/sandbox/browsers.json,~/.openclaw/sandbox/containers/, or~/.openclaw/sandbox/browsers/), doctor reports them;--fixmigrates valid entries into SQLite and quarantines invalid legacy files.
Secrets and channel credentials
- If
gateway.auth.token/gateway.auth.passwordare SecretRef-managed and unavailable in the current command path, doctor reports a read-only warning and does not write plaintext fallback credentials. For exec-backed SecretRefs, doctor skips execution unless--allow-execis present. - If channel SecretRef inspection fails in a fix path, doctor continues and reports a warning instead of exiting early.
- After state-directory migrations, doctor warns when enabled default Telegram or Discord accounts depend on env fallback and
TELEGRAM_BOT_TOKENorDISCORD_BOT_TOKENis unavailable to the doctor process. - Telegram
allowFromusername auto-resolution (doctor --fix) requires a resolvable Telegram token in the current command path. If token inspection is unavailable, doctor reports a warning and skips auto-resolution for that pass.
Was this useful?