[BUG] Compact failed meaning that there was no way to continue the current session
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?
The session reached ~90% of the context window. There was no warning. I got this message:
⎿ Error editing file
⎿ API Error: The model has reached its context window limit.
⎿ Context limit reached · /compact or /clear to continue
I attempted to compact:
❯ /compact
⎿ Error: Error during compaction: Error: Conversation too long. Press esc twice to go up a few messages and try again.
This is a chicken and egg issue. If /compact is the way to recover from this state but /compact cannot run because of that state, the user has no way to continue without losing their context. It is essential that /compact works in this scenario.
What Should Happen?
/compact should always work. There needs to be something akin to a reserve tank so it can always work.
Error Messages/Logs
⎿ Error editing file
⎿ API Error: The model has reached its context window limit.
⎿ Context limit reached · /compact or /clear to continue
❯ /compact
⎿ Error: Error during compaction: Error: Conversation too long. Press esc twice to go up a few messages and try again.
Steps to Reproduce
- During a session I got:
⎿ Error editing file
⎿ API Error: The model has reached its context window limit.
⎿ Context limit reached · /compact or /clear to continue
- I attempted to compact:
❯ /compact
⎿ Error: Error during compaction: Error: Conversation too long. Press esc twice to go up a few messages and try again.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.1.62
Claude Code Version
2.1.63 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗