Bug Description
Running /login while already logged in to one account does not switch to a different account. The login flow appears to complete successfully ("Login successful"), but ~/.claude.json retains the original oauthAccount and the session continues using the old account.
Steps to Reproduce
- Start Claude Code while logged in to Account A (e.g., personal Max plan)
- Run
/login
- Select Account B (e.g., a Teams/Standard account)
- Login reports "Login successful"
- Check
~/.claude.json — oauthAccount still shows Account A
- All subsequent CLI operations (including
claude -p subprocess calls) continue using Account A
Expected Behavior
/login should overwrite the oauthAccount in ~/.claude.json with the newly selected account and switch the active session to use it.
Workaround
Manually remove the oauthAccount key from ~/.claude.json before running /login:
python3 -c "import json; d=json.load(open('$HOME/.claude.json')); d.pop('oauthAccount',None); json.dump(d, open('$HOME/.claude.json','w'), indent=2)"
Then /login prompts for account selection as expected.
Environment
- Claude Code version: 2.1.34
- OS: macOS (Darwin 25.3.0, arm64)
Bug Description
Running
/loginwhile already logged in to one account does not switch to a different account. The login flow appears to complete successfully ("Login successful"), but~/.claude.jsonretains the originaloauthAccountand the session continues using the old account.Steps to Reproduce
/login~/.claude.json—oauthAccountstill shows Account Aclaude -psubprocess calls) continue using Account AExpected Behavior
/loginshould overwrite theoauthAccountin~/.claude.jsonwith the newly selected account and switch the active session to use it.Workaround
Manually remove the
oauthAccountkey from~/.claude.jsonbefore running/login:python3 -c "import json; d=json.load(open('$HOME/.claude.json')); d.pop('oauthAccount',None); json.dump(d, open('$HOME/.claude.json','w'), indent=2)"Then
/loginprompts for account selection as expected.Environment