claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

/compact command fails with 'Conversation too long' error at 82% token capacity

Open halso opened this issue 2 months ago • 7 comments

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:

  1. Have a conversation that reaches approximately 163k/200k tokens (82% capacity)
  2. Run /compact command
  3. 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

halso avatar Oct 11 '25 16:10 halso