openclaw - 💡(How to fix) Fix models auth login overwrites and truncates main openclaw.json; auth-profiles.json silently wipes existing profiles [1 pull requests]

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…

openclaw models auth login --provider <name> has two independent destructive behaviors:

  1. It writes to openclaw.json (it shouldn't — should only touch auth-profiles.json), shrinking it from ~28KB to ~9KB. The size-drop guard catches and rejects the write, but that's the only thing preventing data loss.
  2. It overwrites auth-profiles.json in a way that drops pre-existing profiles for other providers, rather than merging.

Additionally, the type field only accepts "api_key" (snake_case); "apiKey" (camelCase) is silently ignored.

Error Message

Config write rejected: <path>/openclaw.json (size-drop:28183→9212). Rejected payload saved to <path>/openclaw.json.rejected.<ISO-timestamp>. Error: Config write rejected: <path>/openclaw.json

Root Cause

openclaw models auth login --provider <name> has two independent destructive behaviors:

  1. It writes to openclaw.json (it shouldn't — should only touch auth-profiles.json), shrinking it from ~28KB to ~9KB. The size-drop guard catches and rejects the write, but that's the only thing preventing data loss.
  2. It overwrites auth-profiles.json in a way that drops pre-existing profiles for other providers, rather than merging.

Additionally, the type field only accepts "api_key" (snake_case); "apiKey" (camelCase) is silently ignored.

Fix Action

Fixed

Code Example

# Starting state: auth-profiles.json contains a valid deepseek:default profile
openclaw models status   # shows deepseek auth healthy

# Try to add OpenAI key via CLI
openclaw models auth login --provider openai
# (enter valid OpenAI API key when prompted)

---

Config write rejected: <path>/openclaw.json (size-drop:281839212).
Rejected payload saved to <path>/openclaw.json.rejected.<ISO-timestamp>.
Error: Config write rejected: <path>/openclaw.json
RAW_BUFFERClick to expand / collapse

Version: OpenClaw 2026.5.28 (e932160) Platform: Windows (PowerShell) Severity: High — main config truncation prevented only by size-drop guard; auth-profiles silently loses existing profiles

Summary

openclaw models auth login --provider <name> has two independent destructive behaviors:

  1. It writes to openclaw.json (it shouldn't — should only touch auth-profiles.json), shrinking it from ~28KB to ~9KB. The size-drop guard catches and rejects the write, but that's the only thing preventing data loss.
  2. It overwrites auth-profiles.json in a way that drops pre-existing profiles for other providers, rather than merging.

Additionally, the type field only accepts "api_key" (snake_case); "apiKey" (camelCase) is silently ignored.

Reproduction

# Starting state: auth-profiles.json contains a valid deepseek:default profile
openclaw models status   # shows deepseek auth healthy

# Try to add OpenAI key via CLI
openclaw models auth login --provider openai
# (enter valid OpenAI API key when prompted)

Expected

  • auth-profiles.json gets a new openai:default profile merged in
  • Existing deepseek:default profile is preserved
  • openclaw.json is untouched

Actual

Symptom 1: openclaw.json write rejected

Config write rejected: <path>/openclaw.json (size-drop:28183→9212).
Rejected payload saved to <path>/openclaw.json.rejected.<ISO-timestamp>.
Error: Config write rejected: <path>/openclaw.json

The size-drop guard is the only thing preventing complete config truncation.

Symptom 2: auth-profiles.json profiles wiped After the command, auth-profiles.json contains only the newly-added provider — the previously working deepseek:default (and any others) are gone.

Symptom 3: camelCase type silently ignored If the file is manually edited with "type": "apiKey", the profile is silently ignored with no error — only "type": "api_key" works.

Impact

  • Users following CLI prompts to add a new provider silently lose auth for all existing providers
  • The only thing preventing catastrophic config loss is the size-drop guard
  • Misleading: the command name suggests it only touches auth, not main config

Suggested Fix

  1. models auth login should write only to auth-profiles.json, never to openclaw.json
  2. auth-profiles.json writes should merge with existing profiles, not overwrite
  3. type field should normalize camelCase apiKeyapi_key, or at minimum reject with a clear error

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…

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 - 💡(How to fix) Fix models auth login overwrites and truncates main openclaw.json; auth-profiles.json silently wipes existing profiles [1 pull requests]