openclaw - ✅(Solved) Fix [Bug]: GatewayRequestError: invalid config: agents: Unrecognized key: "defaultId" + permanent "unsaved config changes" when changing model on new agent [2 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#59070Fetched 2026-04-08 02:29:06
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
cross-referenced ×2labeled ×2commented ×1referenced ×1

When creating a new agent and attempting to change its Primary model from "Inherit default" to Grok (xai/grok-4) in the Agents UI, the save fails with GatewayRequestError: invalid config: agents: Unrecognized key: "defaultId" and a permanent "You have unsaved config changes" banner appears. Raw mode is also disabled.

Error Message

Error: GatewayRequestError: invalid config: agents: Unrecognized key: "defaultId" The error occurs every time a new agent is created or when trying to change model on an existing agent.

Root Cause

When creating a new agent and attempting to change its Primary model from "Inherit default" to Grok (xai/grok-4) in the Agents UI, the save fails with GatewayRequestError: invalid config: agents: Unrecognized key: "defaultId" and a permanent "You have unsaved config changes" banner appears. Raw mode is also disabled.

Fix Action

Fixed

PR fix notes

PR #59200: fix(ui): stop persisting derived agents.defaultId

Description (problem / solution / changelog)

Summary

  • stop persisting the derived \gents.defaultId\ field from the Agents UI form state
  • persist default-agent changes via \gents.list[*].default\ instead of writing an invalid top-level key
  • add regression coverage and include the config controller tests in the default unit test set

Testing

  • pnpm.cmd exec vitest run ui/src/ui/controllers/config.test.ts ui/src/ui/controllers/agents.test.ts
  • pnpm.cmd exec oxlint ui/src/ui/controllers/config.ts ui/src/ui/controllers/config.test.ts ui/src/ui/app-render.ts vitest.config.ts vitest.unit-paths.mjs
  • pnpm.cmd check
  • pnpm.cmd test -- ui/src/ui/controllers/config.test.ts ui/src/ui/controllers/agents.test.ts

Fixes #59070

Changed files

  • ui/src/ui/app-render.ts (modified, +2/-1)
  • ui/src/ui/controllers/config.test.ts (modified, +79/-0)
  • ui/src/ui/controllers/config.ts (modified, +68/-7)
  • vitest.config.ts (modified, +1/-0)
  • vitest.unit-paths.mjs (modified, +1/-0)

PR #59202: fix(ui): set default agent via agents.list[].default instead of agents.defaultId

Description (problem / solution / changelog)

Summary

  • The "Set as default" handler in the web UI config editor was writing to agents.defaultId, which does not exist in the Zod config schema (AgentsSchema). This caused a validation error on save, silently discarding the user's intent.
  • Now iterates agents.list to set default: true on the target agent and removes default from all other agents, matching the schema's expected shape.

Test plan

  • Open the web UI config editor with multiple agents
  • Click "Set as default" on a non-default agent
  • Verify the config saves without validation errors
  • Verify the correct agent is now marked as default
  • Verify the previous default agent no longer has the default flag

Fixes #59070

Joel Nishanth · offlyn.AI

Made with Cursor

Changed files

  • ui/src/ui/app-render.ts (modified, +15/-1)
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

When creating a new agent and attempting to change its Primary model from "Inherit default" to Grok (xai/grok-4) in the Agents UI, the save fails with GatewayRequestError: invalid config: agents: Unrecognized key: "defaultId" and a permanent "You have unsaved config changes" banner appears. Raw mode is also disabled.

Steps to reproduce

Run openclaw agents add <new-agent-name> --workspace <path> Go to the Agents page in the web UI Select the new agent in the dropdown Change Primary model from "Inherit default" to Grok (xai/grok-4) Click Save

Expected behavior

Expected behavior: The model change should save successfully and the agent should use the selected model.

Actual behavior

Error: GatewayRequestError: invalid config: agents: Unrecognized key: "defaultId" Persistent red banner: "You have unsaved config changes" Pending change shown: agents.defaultId undefined → "<new-agent-name>" Raw mode is disabled with message "Raw mode disabled (snapshot cannot safely round-trip raw text)"

OpenClaw version

2026.3.31 (213a704)

Operating system

macOS 15.7.4

Install method

npm install -g openclaw

Model

xai/grok-4

Provider / routing chain

Local Control UI (web dashboard) → local gateway (127.0.0.1:18789, loopback) → local config validation. Model under test: xai/grok-4

Additional provider/model setup details

Local gateway (127.0.0.1:18789, loopback). Attempting to use xai/grok-4 as Primary model for new agent. Auth profiles are present in the main agent but are not automatically inherited by newly created agents.

Logs, screenshots, and evidence

Impact and severity

Affected users/systems/channels: Solo developer using OpenClaw on macOS attempting to create and configure new agents. Severity: Blocks workflow. Frequency: Always. Consequence: Unable to change Primary model or save agent configuration, preventing use of newly created agents.

Additional information

The gateway is healthy (openclaw gateway status shows RPC probe: ok, Listening: 127.0.0.1:18789). The agent appears correctly in openclaw agents list. The error occurs every time a new agent is created or when trying to change model on an existing agent. Multiple attempts with openclaw doctor --fix, manual editing of ~/.openclaw/openclaw.json, full config deletion, reinstall of OpenClaw, and gateway restarts do not resolve the issue. The config file itself no longer contains defaultId after manual edits, but the UI still shows the pending change.

extent analysis

TL;DR

The most likely fix is to remove the unrecognized "defaultId" key from the agent configuration and update the OpenClaw configuration to reflect the changes.

Guidance

  • Verify that the ~/.openclaw/openclaw.json file does not contain the "defaultId" key after manual edits.
  • Check the OpenClaw UI for any cached or pending changes that may be causing the "You have unsaved config changes" banner to appear.
  • Attempt to save the agent configuration again after removing any pending changes or cached data.
  • If the issue persists, try manually editing the ~/.openclaw/openclaw.json file to remove any references to the "defaultId" key and then restart the OpenClaw gateway.

Example

No code snippet is provided as the issue does not imply a specific code change.

Notes

The provided information suggests that the issue is related to a configuration mismatch between the OpenClaw UI and the underlying configuration file. However, without further information about the OpenClaw configuration and the specific changes made, it is difficult to provide a more detailed solution.

Recommendation

Apply workaround: Manually edit the ~/.openclaw/openclaw.json file to remove any references to the "defaultId" key and then restart the OpenClaw gateway. This is recommended because the issue appears to be related to a configuration mismatch, and manually editing the configuration file may resolve the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Expected behavior: The model change should save successfully and the agent should use the selected model.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: GatewayRequestError: invalid config: agents: Unrecognized key: "defaultId" + permanent "unsaved config changes" when changing model on new agent [2 pull requests, 1 comments, 2 participants]