claude-code
claude-code copied to clipboard
/compact command fails with 'Conversation too long' error at 82% token capacity
Bug Report
Description: The /compact command fails with an error message suggesting the conversation is too long, even when there is still 18.5% free space remaining.
Steps to Reproduce:
- Have a conversation that reaches approximately 163k/200k tokens (82% capacity)
- Run
/compactcommand - Observe error: "Error during compaction: Error: Conversation too long. Press esc twice to go up a few messages and try again."
Current Context:
- Total tokens: 163k/200k (82%)
- Free space: 37k (18.5%)
- Autocompact buffer: 45k tokens (22.5%)
Expected Behavior:
The /compact command should successfully compress the conversation history when there is free space available.
Actual Behavior: Command fails with error suggesting to go back in conversation history, even though there is 18.5% free space.
Impact: Cannot continue long coding sessions without restarting conversation, losing context and progress.
Environment:
- Claude Code CLI
- Model: claude-sonnet-4-5-20250929