/status corrupts OAuth session on narrow terminals — Max switches to Claude API, model downgrade, and 401 errors

Status Fixed / completed
Reported on v2.1.109
Maintainer reply None cached
Activity 4 comments · opened Apr 15, 2026 · closed Apr 16, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

After successful /login using Claude Max (OAuth), the CLI initially works and shows "Opus 4.6 · Claude Max".

However, after running /status and dismissing it (Esc), the session state changes unexpectedly:

  • Banner switches to "Sonnet 4.6 · Claude API"
  • Model downgrades from Opus to Sonnet
  • All subsequent commands fail with:

API Error: 401 (Invalid authentication credentials)

Additionally, the /status output renders incorrectly (garbled vertical text) on a narrow mobile terminal (Termius iOS).

This suggests /status is mutating session/auth state instead of being read-only.

This appears to be a session/auth state corruption triggered by UI rendering (/status) rather than user configuration.

What Should Happen?

/status should be read-only and must not modify:

  • Authentication method (should remain Claude Max OAuth)
  • Model selection (should remain Opus 4.6)
  • Session validity

CLI should remain stable regardless of terminal width or UI rendering issues.

Error Messages/Logs

API Error: 401
{"type":"error","error":{"type":"authentication_error","message":"Invalid authentication credentials"}}

Steps to Reproduce

  1. Launch claude
  2. Run /login → Login successful
  3. Observe banner: Opus 4.6 · Claude Max
  4. Run /status → output renders incorrectly (vertical/garbled)
  5. Press Esc to dismiss
  6. Observe banner switches to: Sonnet 4.6 · Claude API
  7. Run any command → 401 authentication error

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

Unknown (issue started recently, not observed before v2.1.109)

Claude Code Version

2.1.109

Platform

Other

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

Occurs consistently on mobile SSH (Termius on iOS) with a narrow terminal viewport.

Running /status renders incorrectly (garbled/vertical layout). Dismissing it (Esc) immediately flips the banner from "Opus 4.6 · Claude Max" to "Sonnet 4.6 · Claude API".

After that, all commands return:
API Error: 401 (Invalid authentication credentials)

Re-running /login restores functionality temporarily.

Actual environment details:

  • OS: Kali Linux (Debian-based, headless)
  • Terminal: Termius (iOS SSH client, narrow viewport)
  • Auth: Claude.ai OAuth (Max subscription, NOT API key)

Note: Dropdown selections are approximate due to limited options in the GitHub form.

<img width="603" height="1311" alt="Image" src="https://github.com/user-attachments/assets/eeb7a054-c192-4d63-aff7-f86ccf615c0f" />
<img width="603" height="1311" alt="Image" src="https://github.com/user-attachments/assets/af76a465-348e-4aae-9dd2-abd84385a323" />
<img width="603" height="1311" alt="Image" src="https://github.com/user-attachments/assets/3d6f27ea-d791-4a0a-8f2b-84296b60d1d2" />

View original on GitHub ↗

4 Comments

0xbrainkid · 6 months ago

OAuth session state being corrupted by a /status display operation is a real bug — a read-only status check should never mutate auth state. The model downgrade and 401 cascade suggests the status check is either triggering a token refresh that fails, or the narrow terminal rendering is somehow corrupting the stored OAuth token or model selection.

From an agent identity perspective this matters beyond UX: OAuth token state IS the agent identity in sessions that use OAuth auth. If /status can silently swap the model and cause 401s, there is a window where the agent is operating with undefined identity state — it thinks it is authenticated as one model/user combination, but the server is rejecting or degrading those assumptions. Actions taken during that window cannot be reliably attributed or audited.

Two additions worth considering for the fix:

1. Read-only guard on /status. The status command should be explicitly marked as non-mutating in the codebase — any code path in /status that writes to auth state, model selection, or credential storage should be considered a bug. A unit test that verifies /status leaves auth state unchanged (comparing before/after on session state) would prevent regression.

2. Auth state change event. When model selection or auth state changes for any reason other than explicit user action, emit a structured event (log line + optional callback) that downstream tools can intercept. This makes the corruption visible rather than silent — operators can alert on unexpected auth state changes rather than discovering them via 401 errors in production.

Scorpion1190 · 6 months ago

Update: Reproduced on macOS SSH client (standard terminal, wide viewport) connecting to the same VPS. Same behavior — corrupts OAuth session, banner switches from Max to Claude API, followed by 401 errors.

This rules out Termius (iOS) and narrow terminal width as the cause.

  • Termius iOS → Kali VPS — reproduces
  • macOS Terminal → same Kali VPS — reproduces

Bug is in Claude Code v2.1.109 itself, not terminal-specific.

Scorpion1190 · 6 months ago

Resolved in v2.1.110. All issues fixed:

  • /status renders correctly, no session corruption
  • Banner stays on Claude Max after dismissal
  • No 401 errors on subsequent messages or tool calls
  • Multiple messages working without re-login

Regression was isolated to v2.1.109.

github-actions[bot] · 5 months ago

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.