Skip to content

doctor --fix fails atomically when config has multiple validation errors, preventing fixes from persisting #77802

@JIRBOY

Description

@JIRBOY

Bug Description

After upgrading OpenClaw, running openclaw doctor --fix enters a broken loop where no fixes can persist because the tool fails atomically on any validation error.

Reproduction Steps

  1. Have a config with multiple issues, e.g.:
    • plugins.deny references a non-existent plugin (openclaw-weixin)
    • models.providers.bailian.models.*.compat.thinkingFormat has invalid enum values
    • stale plugins.allow / plugins.entries references (acpx)
  2. Run openclaw doctor — it reports all issues and says Run "openclaw doctor --fix" to apply changes.
  3. Run openclaw doctor --fix

Observed Behavior

  • --fix starts by auto-restoring config from last-known-good because the current config is invalid:

    Config auto-restored from last-known-good: ...openclaw.json (doctor-invalid-config); Rejected validation details: plugins.deny: plugin not found: openclaw-weixin; ...

  • It then claims to apply fixes:
    • Set plugins.bundledDiscovery="compat"
    • Installed missing configured plugin "feishu"
    • plugins.allow: removed 1 stale plugin id (acpx)
    • plugins.entries: removed 1 stale plugin entry (acpx)
  • Finally it crashes with exit code 1 due to an unrelated validation error:

    Error: Config validation failed: models.providers.bailian.models.0.compat.thinkingFormat: Invalid input (allowed: "openai", "openrouter", "deepseek", "zai")

  • Run openclaw doctor again — the stale acpx references are back, and all prompts to run --fix reappear.

Expected Behavior

doctor --fix should:

  1. Either not auto-restore last-known-good when the user explicitly asked to fix the current config, OR
  2. Apply all possible fixes and save them incrementally, so that fixing one issue isn't blocked by another unrelated validation error.

Environment

  • OS: Windows 10 Education 10.0.19045
  • Shell: PowerShell
  • OpenClaw: just upgraded to latest

Impact

This makes doctor --fix effectively unusable for real-world configs that accumulate multiple issues across upgrades. Users are forced to manually edit openclaw.json instead of using the automated repair tool.

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions