BUG: /compact command always fails with 'Conversation too long' error
Bug Report
Description
The /compact command is broken and always fails with the error:
Error: Error during compaction: Error: Conversation too long. Press esc twice to go up a few messages and try again.
This error occurs regardless of when the command is run - early in conversation, mid-conversation, or near token limits.
Steps to Reproduce
- Start any Claude Code session
- At any point in the conversation, run
/compact - Command fails with the error above
Expected Behavior
The /compact command should compact the conversation at the current point, similar to how automatic compaction works when a session hits token limits.
Actual Behavior
Command always fails with "Conversation too long" error, making the manual compact feature completely unusable.
Inconsistency
- Automatic compaction (system-triggered at token limit): ✅ Works perfectly
- Manual
/compactcommand (user-triggered): ❌ Always fails
This suggests the command has a bug in how it checks conversation length or determines compaction points.
Impact
Users cannot manually trigger compaction to:
- Control when context is summarized
- Preserve important recent context before hitting auto-compact
- Manage conversation flow proactively
Environment
- OS: macOS (Darwin 25.0.0)
- Claude Code Version: Latest (as of 2025-10-25)
- Session Type: All sessions (new and continued)
Suggested Fix
The /compact command should use the same logic as automatic compaction, or at minimum provide a clearer error message about why it cannot compact at the current point.
Additional Context
The error message "Press esc twice to go up a few messages and try again" is unhelpful because:
- Going up a few messages and retrying produces the same error
- There's no indication of how far back is "safe"
- The command should handle this automatically, not require user intervention
---
User Quote: "Doesn't matter when I run it, this is the error I always get. So what's the point of it?"
This bug makes the /compact command completely non-functional.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗