claude-code - 💡(How to fix) Fix /status corrupts OAuth session on narrow terminals — Max switches to Claude API, model downgrade, and 401 errors [3 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#48524Fetched 2026-04-16 06:57:46
View on GitHub
Comments
3
Participants
2
Timeline
9
Reactions
0
Timeline (top)
labeled ×5commented ×3subscribed ×1

Error Message

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

Code Example

API Error: 401
{"type":"error","error":{"type":"authentication_error","message":"Invalid authentication credentials"}}
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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" />

extent analysis

TL;DR

The issue can be temporarily worked around by re-running the /login command after encountering the 401 authentication error, but a permanent fix likely requires changes to the /status command to prevent it from modifying the session state.

Guidance

  • The /status command seems to be causing the session state to change unexpectedly, leading to authentication errors. Verifying this by checking the code changes related to the /status command and session management might provide insights.
  • To mitigate the issue, users can try re-running the /login command after encountering the 401 error, as this temporarily restores functionality.
  • Investigating how the /status command handles different terminal widths and UI rendering might reveal why it corrupts the session state on narrow terminals like Termius on iOS.
  • Checking the differences between the current version (2.1.109) and the last known working version could help identify the regression cause.

Example

No specific code snippet can be provided without access to the Claude Code base, but an example of how session state might be handled incorrectly in the /status command could involve improper updates to authentication tokens or model selections.

Notes

The provided information suggests a regression introduced in or after version 2.1.109, but without knowing the exact changes made, it's challenging to provide a precise fix. The issue seems to be related to how the /status command interacts with the session state, particularly on narrow terminals.

Recommendation

Apply workaround: Re-run the /login command after encountering the 401 authentication error, as this provides a temporary solution until the root cause can be addressed and a permanent fix implemented.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING