/compact fails with 'Conversation too long' when context is nearly full
Resolved 💬 4 comments Opened Feb 18, 2026 by programmer-b Closed Apr 2, 2026
Bug Description
/compact fails when the conversation context is nearly full, producing the error:
Error: Error during compaction: Error: Conversation too long. Press esc twice to go up a few messages and try again.
This creates a deadlock situation: the context is too long to continue working, but also too long to compact.
Steps to Reproduce
- Run a long session with many parallel subagents (in my case, ~15 agents updating i18n JSON files)
- Each agent completes and returns results, filling the context
- Context reaches ~96% full (4% remaining until auto-compact)
- Multiple agents show "Context limit reached · /compact or /clear to continue"
- Run
/compact - Compaction fails with the error above
Expected Behavior
/compact should be able to compress the conversation even when context is nearly full. If the conversation is too long for a single compaction pass, it could:
- Compact in chunks/stages
- Drop older messages before attempting compaction
- Use a more aggressive summarization strategy when context is critically low
Actual Behavior
/compact fails entirely, leaving the user with only /clear as an option (which loses all context).
Environment
- Claude Code CLI
- Model: Claude Opus 4.6
- ~108 files changed (+15049 -7504)
- ~15 parallel subagents had completed before the failure
Screenshot
The error appears at the bottom of the terminal:
/compact
└ Error: Error during compaction: Error: Conversation too long. Press esc twice to go up a few messages and try again.
Status bar shows: "Error compacting conversation" and "Context left until auto-compact: 4%"
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗