Description
Running openclaw doctor --fix or openclaw doctor --repair removes custom API keys from the secrets section of openclaw.json.
Steps to Reproduce
- Add custom API keys directly under the
secrets section:
"secrets": {
"brave_news_api_key": "BSACsc...",
"football_data_api_key": "ac6b2a...",
"alpha_vantage_api_key": "J22HYYG..."
}
- Run
openclaw doctor --fix or openclaw doctor --repair
- Check
openclaw.json - the secrets section is now empty: "secrets": {}
Expected Behavior
Custom API keys stored directly under secrets should be preserved during doctor runs.
Root Cause
The SecretsConfigSchema in auth-profiles-CNyDTsy4.js uses .strict() validation which only allows 3 specific keys:
providers
defaults
resolution
When doctor runs with --fix/--repair, it calls stripUnknownConfigKeys() which uses Zod's strict validation. Custom keys like brave_news_api_key are treated as "unrecognized keys" and deleted.
Suggested Fix
Change SecretsConfigSchema from .strict() to .catchall(z.string()) to allow arbitrary key-value pairs.
Environment
- OpenClaw version: 2026.3.2
- Node version: v22.22.0
- OS: Linux (Raspberry Pi)
Workaround
Run openclaw doctor without --fix or --repair flags to avoid key deletion.
Description
Running
openclaw doctor --fixoropenclaw doctor --repairremoves custom API keys from thesecretssection ofopenclaw.json.Steps to Reproduce
secretssection:openclaw doctor --fixoropenclaw doctor --repairopenclaw.json- the secrets section is now empty:"secrets": {}Expected Behavior
Custom API keys stored directly under
secretsshould be preserved during doctor runs.Root Cause
The
SecretsConfigSchemainauth-profiles-CNyDTsy4.jsuses.strict()validation which only allows 3 specific keys:providersdefaultsresolutionWhen doctor runs with
--fix/--repair, it callsstripUnknownConfigKeys()which uses Zod's strict validation. Custom keys likebrave_news_api_keyare treated as "unrecognized keys" and deleted.Suggested Fix
Change
SecretsConfigSchemafrom.strict()to.catchall(z.string())to allow arbitrary key-value pairs.Environment
Workaround
Run
openclaw doctorwithout--fixor--repairflags to avoid key deletion.