[BUG] Reaching context limit is not allowing to manual /compact at all
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?
I had a very large context where Claude needed to think through a lot of steps and perform many actions. Auto-compact was turned off, and the context reached 199,125 tokens and stopped working. When I tried to compact manually, I got an error. Since it was all in a single message and the context window was full, using /rewind would have made me lose everything. But I also couldn’t trigger /compact because the context window wouldn’t allow it.
I believe this is an edge case where the proposed workarounds don’t help, because the work was contained in a single long session. Once the context window is fully exhausted, I can’t run /compact (it errors), and /rewind would cause me to lose critical content. In other words, there’s no recovery path that preserves the session state.
I also understand that similar issues have been reported before, but this scenario still appears to have no practical resolution.
What Should Happen?
When the context window is full and the agent can’t continue working, the user should always be able to run /compact. There should be a reserved portion of the context specifically allocated for compaction, so the process can run even when the main context window is exhausted.
Error Messages/Logs
/compact
⎿ Error: Error during compaction: Error: Conversation too long. Press esc twice to go up a few messages and try again.
Steps to Reproduce
- Disable auto-compact in Claude settings.
- Start a session with a very large prompt that requires extensive reasoning and multiple tool actions.
- Continue interacting until the context window reaches its limit (around 199k tokens).
- At this point, Claude stops responding because the context window is full.
- Try running /compact manually.
- Observe that /compact fails with an error due to the full context window.
- Try using /rewind as an alternative.
- Observe that /rewind would remove critical parts of the conversation, making it unusable.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.41
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗