-
-
Notifications
You must be signed in to change notification settings - Fork 39.8k
Description
Summary
When saving configuration changes through the Web UI Form Editor, all numeric fields (e.g., maxTokens, contextWindow, cost.*) under models.providers are serialized as strings instead of numbers. This causes config.set to reject the payload with "invalid config", while saving the exact same configuration via Raw Config or CLI succeeds.
Steps to Reproduce
- Add a custom model provider with numeric fields in
openclaw.json(via Raw Config or CLI):{ models: { providers: { xai: { baseUrl: "https://api.x.ai/v1", api: "openai-completions", models: [ { id: "grok-4", name: "Grok 4", contextWindow: 131072, maxTokens: 8192, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 } } ] } } } }
- Open the Web UI → Settings → Form Editor.
- Change any setting (does not need to be related to the model provider).
- Click Save.
Result: Error: invalid config
Root Cause
The Form Editor's <input> fields produce string values by default. When the form is serialized for config.set, numeric fields like maxTokens are sent as "8192" (string) instead of 8192 (number).
Server-side validation (validateConfigObjectWithPlugins) then rejects the payload:
path: models.providers.xai.models.0.maxTokens
message: Invalid input: expected number, received string
Evidence
Added temporary console.error logging inside the config.set handler to capture validated.issues:
[DEBUG config.set] validation issues: [
{
"path": "models.providers.xai.models.0.maxTokens",
"message": "Invalid input: expected number, received string"
}
]
Meanwhile, submitting the identical config file content via CLI succeeds:
openclaw gateway call config.set --params '{"raw": "<file contents>", "baseHash": "<hash>"}'
# ✓ succeeds — all numeric fields are correctly typed in the JSON fileExpected Behavior
The Form Editor should coerce values to their schema-defined types (number, boolean, etc.) before submitting to config.set. Alternatively, the config.set handler could coerce known numeric fields from strings.
Workaround
Use Raw Config editor instead of Form Editor to save configuration changes.
Environment
- OpenClaw: 2026.2.9 (gateway) / 2026.2.1 (service unit)
- OS: Ubuntu 25.04 (VPS)
- Node: v22.x
- Browser: safari (macOS)