Skip to content

Diagnostics and Quick Fixes

Goal: understand why diagnostics appear, how sources differ, and what each quick fix changes.

Diagnostic Sources

SourcePurposeTypical Examples
json-schemaStructural schema validationmissing/invalid properties, type mismatch
openclaw-zodAdditional semantic diagnosticsduplicate/semantic issues not fully covered by schema
openclaw-integratorCross-reference and security hygiene checksunknown bindings[].agentId, invalid account references, cleartext secret values

Practical note: Zod diagnostics are deduplicated against overlapping non-informational external diagnostics to reduce noise.

Quick Fix Matrix

Trigger PatternQuick Fix ActionResulting Change
$schema missing/wrongSet $schema to OpenClaw URIAdds or replaces $schema with openclaw-schema://live/openclaw.schema.json
Unknown key diagnosticRemove unknown keyRemoves offending property path from JSONC
Duplicate agentDir warningRemove duplicate agentDir overridesKeeps first seen agentDir, removes duplicate overrides
Invalid bindings[] referenceRemove invalid binding entryRemoves referenced bindings[index] object
Cleartext secret hygiene issueReplace with ${env:...}Replaces value with generated env reference

Before/After Examples

1) Insert or replace $schema

Before:

jsonc
{
  "gateway": {}
}

After:

jsonc
{
  "$schema": "openclaw-schema://live/openclaw.schema.json",
  "gateway": {}
}

2) Remove unknown key

Before:

jsonc
{
  "gateway": {},
  "unknownKey": true
}

After:

jsonc
{
  "gateway": {}
}

3) Remove duplicate agentDir overrides

Before:

jsonc
{
  "agents": {
    "list": [
      { "id": "alpha", "agentDir": "./agents/a" },
      { "id": "beta", "agentDir": "./agents/b1" },
      { "id": "beta", "agentDir": "./agents/b2" }
    ]
  }
}

After:

jsonc
{
  "agents": {
    "list": [
      { "id": "alpha", "agentDir": "./agents/a" },
      { "id": "beta" },
      { "id": "beta" }
    ]
  }
}

4) Remove invalid binding entry

Before:

jsonc
{
  "bindings": [
    { "agentId": "valid-agent" },
    { "agentId": "missing-agent" }
  ]
}

After:

jsonc
{
  "bindings": [
    { "agentId": "valid-agent" }
  ]
}

5) Replace cleartext secret with env reference

Before:

jsonc
{
  "gateway": {
    "apiKey": "my-plain-token"
  }
}

After:

jsonc
{
  "gateway": {
    "apiKey": "${env:OPENCLAW_GATEWAY_APIKEY}"
  }
}

Failure Modes and Recovery

  • No quick fix appears:
    • Confirm openclawConfig.codeActions.enabled is true.
    • Confirm cursor is on the diagnostic and command palette context is openclaw.json.
  • Quick fix does not change file:
    • Payload may be stale after edits; rerun quick fix after save.
  • Unexpected path behavior:
    • Run OpenClaw: Normalize Config first, then retry quick fix.

MIT Licensed