[Bug] Unexpected Model Switching Between Terminal Sessions
Status Closed — duplicate
Maintainer reply ✓ Yes — claude[bot]
Activity 14 comments · opened Sep 9, 2025 · closed Apr 17, 2026
💡 Likely answer: A maintainer (claude[bot], contributor)
responded on this thread — see the highlighted reply below.
Bug Description
I had claude open in one terminal tab (in ghostty), on macOS; I was running a task with Sonnet 4. I started claude in another terminal (in VSCode); I was running a task with Opus 4.1. I go back to the first terminal tab, and I see that in Claude's response to me, it was waiting on a permission prompt to proceed. and when I approved it, I noticed the model in my statusline has changed from Sonnet to Opus. this has happened several times in the past week or so, possibly always (?). thank you for your help resolving this. and thank you for building such a wonderful product.
Environment Info
- Platform: darwin
- Terminal: ghostty
- Version: 1.0.109
- Feedback ID:
Errors
[{"error":"SyntaxError: Unexpected token H in JSON at position 53\n at JSON.parse (<anonymous>)\n at file:///Users/whoami/.nvm/versions/node/v18.19.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:733:9932\n at Q (file:///Users/whoami/.nvm/versions/node/v18.19.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:713:13288)\n at at2 (file:///Users/whoami/.nvm/versions/node/v18.19.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:1095:1982)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2025-09-09T09:01:36.817Z"},{"error":"Error: Request was aborted.\n at i61._createMessage (file:///Users/whoami/.nvm/versions/node/v18.19.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:971:7955)","timestamp":"2025-09-09T09:31:49.486Z"},{"error":"AxiosError: Request failed with status code 403\n at XN (file:///Users/whoami/.nvm/versions/node/v18.19.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:715:1077)\n at Unzip.G0 (file:///Users/whoami/.nvm/versions/node/v18.19.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:716:9955)\n at Unzip.emit (node:events:529:35)\n at Unzip.emit (node:domain:489:12)\n at endReadableNT (node:internal/streams/readable:1400:12)\n at process.processTicksAndRejections (node:internal/process/task_queues:82:21)\n at fB1.request (file:///Users/whoami/.nvm/versions/node/v18.19.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:718:2088)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async AL5 (file:///Users/whoami/.nvm/versions/node/v18.19.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:2414:472)\n at async Promise.all (index 0)\n at async file:///Users/whoami/.nvm/versions/node/v18.19.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:2400:9205","timestamp":"2025-09-09T09:36:31.816Z"}]
14 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
I am having the same issue at v2.0.42!
I just used Opus 4.1 for multiple dumb tasks.. very frustrating
Same here - blew through opus quota for the week. The status line showing the model didn't seem to update consistently across sessions and though I noticed it on one, interrupted, and reset the others kept running with the wrong model. Very sad :( This did used to work: I could switch one session to opus, plan, and switch back to sonnet in isolation, so it's a recent regression.
Still reproducing on v2.0.53 (Linux/WSL2). I've done some diagnostic work that may help identify the root cause.
Diagnostic Setup
Added logging to my statusline script to capture what Claude Code sends via the hook:
Findings
1. Cross-session model bleeding confirmed:
When running
/modelin one session, other sessions' statuslines update to show the same model:2.
/modelupdates API calls but NOT statusline hook data:After running
/model sonnet, the API correctly uses Sonnet (Claude responds as Sonnet), but the statusline hook still receives:Root Cause Hypothesis
Claude Code appears to have two separate code paths:
The statusline hook JSON generation may be reading from global state that gets overwritten when any session changes models, rather than per-session state.
The
session_idin the JSON is correct and unique per session - only themodelfield is wrong.This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
this issue is still occuring.
https://github.com/anthropics/claude-code/issues/15467
Still reproducing on v2.0.76+ (macOS Darwin 25.2.0).
This issue is CRITICAL - it causes actual financial damage when users unknowingly use expensive models.
Confirmed Reproduction (2026-01-23)
Environment:
~/.claude/scripts/context-bar.shSteps:
/model sonnet→ Status bar shows "Sonnet 4.5" ✅/model opus→ Session B shows "Opus 4.5" ✅/model: Session A is still using Sonnet (API calls correct) ✅Impact:
Supporting Evidence
Per @akatz-ai's excellent diagnostics:
The
session_idin statusline JSON is correct, butmodel.display_nameis shared globally instead of per-session.Workaround
No reliable workaround exists. Users must:
/modelin EVERY session after ANY model changeRelated Issues
This is the ORIGINAL issue. All others are duplicates:
This issue has been open since September 2025 and needs urgent attention.
This is still happening on 2.1.37
This is happening on 2.1.45 (Claude Code)
Still happening on 2.1.63
Still happening.
Still happening in v2.1.83
This is a duplicate of #37596, which was fixed as of version 2.1.85.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.