Skip to content

[Bug]: Control UI Config Save fails: config.set JSON5 parse error at random line (file on disk validates) + SecretRef token confusion #48415

@00Blacksheep00

Description

@00Blacksheep00

Bug type

Behavior bug (incorrect output/state without crash)

Summary

Version

OpenClaw 2026.3.13 (61d171a)

What I’m trying to do

Edit/save config from the Control UI (both Form and Raw).

Expected

Save succeeds (gateway accepts config.set/config.apply) and config persists.

Actual

Control UI Save fails. Gateway logs show errors like:

  • JSON5 parse error on config.set:
    SyntaxError: JSON5: invalid character ',' at 218:4

  • Sometimes also schema validation errors around env SecretRef ids, e.g.:
    channels.telegram.accounts.default.botToken.id: Env secret reference id must match /^[A-Z][A-Z0-9_]{0,127}$/

Important: the config file on disk validates:
openclaw config validate => Config valid: ~/.openclaw/openclaw.json

And the snippet around line 218 in the file looks valid JSON5:
(paste nl -ba ~/.openclaw/openclaw.json | sed -n '208,228p' here)

Logs

From openclaw logs --follow while clicking Save in UI:
(paste the gateway/ws ... config.set ... lines here)

Notes

  • Using SecretRefs for Telegram/Discord tokens stored in ~/.openclaw/.env
  • openclaw secrets reload succeeds (warnings only, inactive surfaces)
  • Looks like the UI is sending a different/invalid raw config draft than the file on disk.

Steps to reproduce

Edit/save config from the Control UI (both Form and Raw).

Expected behavior

Save succeeds (gateway accepts config.set/config.apply) and config persists.

Actual behavior

Control UI Save fails. Gateway logs show errors like:

  • JSON5 parse error on config.set:
    SyntaxError: JSON5: invalid character ',' at 218:4

  • Sometimes also schema validation errors around env SecretRef ids, e.g.:
    channels.telegram.accounts.default.botToken.id: Env secret reference id must match /^[A-Z][A-Z0-9_]{0,127}$/

Important: the config file on disk validates:
openclaw config validate => Config valid: ~/.openclaw/openclaw.json

And the snippet around line 218 in the file looks valid JSON5:
(paste nl -ba ~/.openclaw/openclaw.json | sed -n '208,228p' here)

“On-disk config validates (openclaw config validate OK) but Control UI save sends invalid JSON5 (line numbers don’t match file length).

OpenClaw version

2026.3.13

Operating system

macos 15.4

Install method

npm global

Model

openrouter/anthropic/claude-sonnet-4.6pic/

Provider / routing chain

openclaw tailscale

Config file / key location

No response

Additional provider/model setup details

No response

Logs, screenshots, and evidence

18:05:54 info gateway/ws {"subsystem":"gateway/ws"} ⇄ res ✗ config.set 21ms errorCode=INVALID_REQUEST errorMessage=SyntaxError: JSON5: invalid character 'l' at 641:20 conn=98986034…a4c3 id=4d070e47…14fd
18:06:24 info gateway/ws {"subsystem":"gateway/ws"} ⇄ res ✓ channels.status 4716ms conn=98986034…a4c3 id=1bca9ca8…930c
18:06:40 info gateway/ws {"subsystem":"gateway/ws"} ⇄ res ✗ config.set 26ms errorCode=INVALIDREQUEST errorMessage=invalid config: channels.telegram.accounts.default.botToken.id: Env secret reference id must match /^[A-Z][A-Z0-9]{0,127}$/ (example: "OPENAI_API_KEY").; channels.telegram.accounts.mr-zero.botToken.id: Env secret reference id must match /^... conn=98986034…a4c3 id=865805f5…24e0

Impact and severity

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbug:behaviorIncorrect behavior without a crash

    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