# "OpenClaw config is invalid": the gateway won't start after you edited openclaw.json

- Fix ID: AGT-11
- Exact error: `OpenClaw config is invalid`
- Status: Manually verified (CI: pending, no CI results exist yet)
- Last verified: 2026-10-26
- Platforms: OpenClaw
- Versions: os=Debian 13 (container); node=26.12.1; openclaw=2026.10.7 (157d8c2)
- Repro: https://stucktoshipped.com/repros/AGT-11/ (file hashes only; files are in the paid repro bundle)
- Canonical: https://stucktoshipped.com/fixes/openclaw/config-is-invalid/

## In brief
OpenClaw rejects unknown keys and invalid JSON5. The full fix covers both cases, what `doctor --fix` really does to your config (it is not harmless), and how to confirm the config is valid again.

## Symptom
You hand-edited `~/.openclaw/openclaw.json`, or an AI pasted a snippet into it. Now `openclaw gateway` stops immediately with:

```
OpenClaw config is invalid
File: ~/.openclaw/openclaw.json
Problem:
  - openclaw.json:2 — gateway: Unrecognized key: "prot"
...
Run "openclaw doctor --fix" to repair the config, then retry.
```
or, for a typo in the JSON itself:
```
  - <root>: JSON5 parse failed: SyntaxError: JSON5: invalid character '"' at 4:5
```

## Why it happens
- **OpenClaw checks the whole config on startup and refuses anything it doesn't recognise,** including misspelled keys and settings in the wrong place.
- **The file must also be valid JSON5.** A missing comma or a stray character breaks the whole file.

## What we could not test
- Automatic migration of legacy keys after upgrades, the `.clobbered.*` / `.rejected.*` recovery files, and configs that use `$include`.
- Hot-reload of an edited config while the gateway runs.
- Docker or Nix installs, macOS and Windows.

## Full fix (paid)
The step-by-step fix, commands and test record are paid content and are not in this file. Price: $4 per fix (planned launch price; checkout not open yet). SHA-256 of the full fix: dfb37473a2122886bd4a04684d4a624b4d9e78f2f9d224f100522d408219fbf4. How to buy: https://stucktoshipped.com/pricing/ and https://stucktoshipped.com/products.json

## Sources
- [OpenClaw docs: Config validation and checks](https://docs.openclaw.ai/gateway/troubleshooting/config-validation-and-probes)
- [OpenClaw docs: troubleshooting](https://docs.openclaw.ai/help/troubleshooting)
- [GitHub #78407: doctor --fix rewrote model refs on update](https://github.com/openclaw/openclaw/issues/78407)
- [GitHub #13835: config rewrite after update/doctor dropped gateway.auth](https://github.com/openclaw/openclaw/issues/13835)

## How this page was made
Drafted by an AI agent and reproduced on our test machine on 2026-10-26. No warranty; test on a copy first.
