Skip to content

openclaw.json is not valid JSON - OpenClaw

Quick fix

Add double quotes around the models key in ~/.openclaw/openclaw.json by hand to fix the strict JSON parse failure.

Error output
OpenClaw config at ...\.openclaw\openclaw.json is not valid JSON

When saving OpenClaw provider config, cc-switch appears to assemble a template string rather than serialising properly, so the top-level `models` key written into `~/.openclaw/openclaw.json` is unquoted (JSON5 style). OpenClaw itself tolerates that format, but third-party tools relying on strict JSON parsing, such as aily-cli, error outright. Related versions also have UI defects: the "set as default" button staying disabled after changing the default model (#5366), and being unable to add a config by copying (#1713).

  1. Open `~/.openclaw/openclaw.json` and find the unquoted `models` key, usually around line 89.

    // ~/.openclaw/openclaw.json
    models: {
    "models": {
  2. Save the file and strict JSON parsers work again. You can also do it in bulk from a terminal: `sed -i 's/^\( \)models: {/\1"models": {/' ~/.openclaw/openclaw.json`

ToolOpenClaw
Versioncc-switch 3.17.0 - 3.19.2 (affected)
PlatformsWindows
Why does the OpenClaw gateway run fine while the Feishu agent cannot call it locally?
OpenClaw tolerates JSON5 format, so the gateway runs fine. But the openclaw adapter in Feishu aily-cli reads the file with strict JSON, fails to parse the unquoted `models` key, and decides the adapter is unavailable.
The "set as default" button stays disabled after I change the current provider model ID. What now?
A known defect in cc-switch 3.17.0: saving the config does not update the OpenClaw default model field automatically. As a stopgap, set another provider as default first, then return to the target provider and the "set as default" button becomes clickable again.
Why can I not add a config by copying on the OpenClaw page?
A UI defect in early versions that prevented copy-and-modify as in Claude Code. Fixed in a later version (#1724).

This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.