[BUG] Switching from Sonnet back to Opus after "prompt too long" error leaves session in broken state
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 accidentally switching from Opus to Sonnet mid-session, Sonnet triggered a "Prompt is too long" error. Switching back to Opus did not recover the session — it remained broken. /compact was unavailable, and opening a new session did not resolve the issue.
What Should Happen?
Switching back to Opus (which supports a larger context window) should clear the error state and allow the session to resume normally.
Error Messages/Logs
Steps to Reproduce
Start a long Claude Code session using Opus with a large codebase context
Accidentally switch model to Sonnet (e.g. via /model)
Sonnet returns "Prompt is too long" error (Sonnet has a smaller context window)
Switch back to Opus
Session remains broken — cannot send messages, /compact is unavailable
Opening a new session does not resolve the issue
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.34
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗