Compaction fails with 'Conversation too long' error when context is large
Bug Description
When attempting to compact a conversation (via /compact or the compact button), the following error appears:
Error during compaction: Error: Conversation too long. Press esc twice to go up a few messages and try again.
Steps to Reproduce
- Have a long conversation with Claude Code (large context window usage)
- Attempt to compact the conversation
- Compaction fails with the above error
Expected Behavior
Compaction should work precisely when the conversation is long — that is the main use case for it. If the context is too long to compact, Claude Code should:
- Either compact a subset of older messages
- Or provide a clearer explanation of what the user should do
Actual Behavior
Compaction itself fails with an error, leaving the user stuck. The error message says to "press esc twice and go up a few messages and try again," but this is not intuitive and doesn't resolve the underlying issue.
Why This Is a Problem
The compaction feature is intended to help users when their conversation gets too long. Failing at exactly that moment is a critical UX issue — it's like a life jacket that doesn't work when you're drowning.
Environment
- Platform: Windows 11
- Shell: bash
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗