claude sessions write autoMode:true into profile settings; CCR syncs it into the config store and rewrites it into settings.json on every launch, which makes Claude Code ignore apiKeyHelper ("Not logged in")

Author: kurtonthewayCreated Sep 14, 2026Updated Sep 16, 2026

claude sessions write autoMode: true into profile settings; CCR syncs it into config and rewrites it into settings.json on every launch → Claude Code ignores apiKeyHelper and reports "Not logged in"

Environment

  • Claude Code Router Desktop v3.1.0 (Windows, port 3456 gateway)
  • Windows 10 19045 x64
  • Claude Code CLI 2.1.270
  • Auth mode: profile-managed apiKeyHelper pointing at bin/ccr-claude-code-api-key-<profile>.cmd (gateway token), ANTHROPIC_BASE_URL=http://127.0.0.1:3456

Summary

Claude Code (CLI ≥ the autoMode builds) persists autoMode: true into <CLAUDE_CONFIG_DIR>/settings.json when the user enables automatic mode in a session. For the CCR-managed profile (CLAUDE_CONFIG_DIR=%APPDATA%\claude-code-router\profiles\default-claude-code\claude), this triggers a feedback loop that fully breaks gateway auth:

  1. Claude Code writes autoMode: true (plus autoMemoryEnabled, autoCompactEnabled) into the profile settings.json during a session.
  2. CCR picks those up as claudeSettings in its config store (visible in profile.profiles[].claudeSettings).
  3. On every ccr-app "<Profile>" launch, CCR PREPARE regenerates settings.json from the config store — so autoMode is now persistent and cannot be removed by editing settings.json.
  4. With autoMode: true present, Claude Code ignores apiKeyHelper and demands the interactive login flow: every session prints Not logged in · Please run /login and requests fail until /login is run.

So a single session where the user toggles auto mode permanently disables gateway auth for that profile — with no error in CCR, and nothing in the UI indicating that claudeSettings.autoMode now controls auth.

Root-cause isolation (bisection evidence)

I bisected the profile settings file (everything else verbatim, one key removed per run, apiKeyHelper always present and valid):

settings.json state Result
Full profile settings (incl. autoMode) Not logged in · Please run /login
Full profile minus autoMode auth via apiKeyHelper works, requests succeed
Full profile minus autoMemoryEnabled only still Not logged in
Full profile minus autoCompactEnabled only still Not logged in

(model, modelSettings, env block contents, and the discovery flag were all individually ruled out as well.)

Recovery: stop CCR Desktop → remove claudeSettings.autoMode from the config store (e.g. delete the key from the profile's claudeSettings) → start CCR → auth via apiKeyHelper works again.

Why this hurts

  • The failure is silent in CCR: the gateway is healthy, the token helper is valid, but every session says "Not logged in".
  • The user-facing action that causes it (toggling auto mode in a Claude session) has no warning, and the fix requires editing the CCR config store by hand with CCR stopped.
  • apiKeyHelper is the auth mechanism CCR itself sets up for gateway profiles, so this makes CCR-managed profiles unstable against Claude Code's own settings writes.

Suggested directions

Any of these would prevent the loop:

  1. Don't sync autoMode into claudeSettings (treat it like other auth-adjacent state CCR owns), or
  2. Don't write autoMode back into settings.json when regenerating (leave Claude-managed keys alone in the managed file), or
  3. At minimum: when apiKeyHelper is configured and autoMode: true is present, surface a warning in the UI ("this combination disables gateway auth") — and consider a one-click "fix" that removes autoMode from the store.

Related existing reports about CCR unconditionally taking over profile settings: #1575, #1602 (same "regenerated on every launch" surface, different keys).

Reproduction outline

  1. Fresh CCR-managed Claude Code profile (apiKeyHelper + gateway base URL).
  2. In a Claude Code session, enable auto mode → Claude writes autoMode: true into the profile settings.json.
  3. Restart the profile (ccr-app "<Profile>" or UI launch): settings.json still contains autoMode (now also in the CCR store).
  4. Any prompt → Not logged in · Please run /login; title-generation requests log [claude-code:unrecognized_model]-style noise or auth errors.
  5. Remove autoMode from the store with CCR stopped → launch → auth works.

Happy to attach the full bisection transcript or test a candidate fix.

Source: musistudio/claude-code-router