Preflight Checklist
What's Wrong?
Environment
- Claude Code version: 2.1.199 (native installer, single installation at ~/.local/bin/claude)
- OS: macOS (MacBook Pro)
- Terminal: Terminal.app (local GUI session, no SSH, no tmux)
- Auth method: Claude subscription (Pro/Max), NOT API key
Bug Description
Running /login completes the OAuth flow in the browser and shows
"Login successful", but immediately after, Claude Code shows
"Not logged in · Please run /login". The credentials are never
persisted — the login loop repeats indefinitely (tried ~20 times).
What I ruled out (diagnostics)
- Keychain itself works fine — verified write/read/delete:
security add-generic-password / find-generic-password /
delete-generic-password with a test entry all succeed.
- The credential entry is NEVER created:
security find-generic-password -s "Claude Code-credentials" -a "$USER" -w
→ "The specified item could not be found in the keychain."
security dump-keychain | grep -i claude only shows
"Claude Safe Storage" (Claude Desktop app), no CLI entry at all.
- No file fallback exists:
~/.claude/.credentials.json does not exist.
- No conflicting env vars:
ANTHROPIC_API_KEY and
CLAUDE_CODE_OAUTH_TOKEN are both unset; nothing related in
~/.zshrc / ~/.zprofile / ~/.zshenv.
- No
apiKeyHelper or forceLoginMethod in settings.
settings.json only contains model/tui/theme options.
- Single installation confirmed:
which -a claude →
only /Users//.local/bin/claude. Reinstalled via
curl -fsSL https://claude.ai/install.sh | bash — no change.
- Keychain unlocked manually (
security unlock-keychain) — no change.
~/.claude.json and ~/.claude are owned by my user with
correct permissions. ~/.claude.json does contain an
"oauthAccount" key, so account info is written, but the token is not.
Workaround
claude setup-token + CLAUDE_CODE_OAUTH_TOKEN env var works,
confirming the OAuth flow itself is fine — only credential
persistence is broken.
What Should Happen?
Expected Behavior
After a successful OAuth login, the token should be written to the
macOS Keychain ("Claude Code-credentials") or to
~/.claude/.credentials.json, and the session should stay authenticated.
Actual Behavior
"Login successful" is displayed, but no credential is written anywhere
(neither Keychain nor file), so authentication is lost instantly.
Error Messages/Logs
Steps to Reproduce
Steps to Reproduce
- Start
claude in any project
- Run
/login, complete browser OAuth (subscription account)
- Terminal shows "Login successful"
- Next screen immediately shows "Not logged in · Please run /login"
Claude Model
None
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
2.1.199
Platform
Other
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
No response
Preflight Checklist
What's Wrong?
Environment
Bug Description
Running
/logincompletes the OAuth flow in the browser and shows"Login successful", but immediately after, Claude Code shows
"Not logged in · Please run /login". The credentials are never
persisted — the login loop repeats indefinitely (tried ~20 times).
What I ruled out (diagnostics)
security add-generic-password/find-generic-password/delete-generic-passwordwith a test entry all succeed.security find-generic-password -s "Claude Code-credentials" -a "$USER" -w→ "The specified item could not be found in the keychain."
security dump-keychain | grep -i claudeonly shows"Claude Safe Storage" (Claude Desktop app), no CLI entry at all.
~/.claude/.credentials.jsondoes not exist.ANTHROPIC_API_KEYandCLAUDE_CODE_OAUTH_TOKENare both unset; nothing related in~/.zshrc / ~/.zprofile / ~/.zshenv.
apiKeyHelperorforceLoginMethodin settings.settings.json only contains model/tui/theme options.
which -a claude→only /Users//.local/bin/claude. Reinstalled via
curl -fsSL https://claude.ai/install.sh | bash— no change.security unlock-keychain) — no change.~/.claude.jsonand~/.claudeare owned by my user withcorrect permissions.
~/.claude.jsondoes contain an"oauthAccount" key, so account info is written, but the token is not.
Workaround
claude setup-token+CLAUDE_CODE_OAUTH_TOKENenv var works,confirming the OAuth flow itself is fine — only credential
persistence is broken.
What Should Happen?
Expected Behavior
After a successful OAuth login, the token should be written to the
macOS Keychain ("Claude Code-credentials") or to
~/.claude/.credentials.json, and the session should stay authenticated.
Actual Behavior
"Login successful" is displayed, but no credential is written anywhere
(neither Keychain nor file), so authentication is lost instantly.
Error Messages/Logs
Steps to Reproduce
Steps to Reproduce
claudein any project/login, complete browser OAuth (subscription account)Claude Model
None
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
2.1.199
Platform
Other
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
No response