/login does not switch accounts when already logged in
Resolved 💬 8 comments Opened Feb 7, 2026 by ratsch Closed May 25, 2026
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—oauthAccountstill shows Account A - All subsequent CLI operations (including
claude -psubprocess 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)
This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗