/compact fails with 'Conversation too long' at 25% context usage

Resolved 💬 4 comments Opened Feb 15, 2026 by fkhawajagh Closed Mar 17, 2026

Bug Description

/compact fails with the error:

Error: Error during compaction: Error: Conversation too long. Press esc twice to go up a few messages and try again.

Despite having significant free context space remaining.

Context at time of error

Running /context immediately after the error showed:

claude-opus-4-6 · 51k/200k tokens (25%)

Estimated usage by category
⛁ System prompt: 3k tokens (1.5%)
⛁ System tools: 16.9k tokens (8.5%)
⛁ Custom agents: 2.9k tokens (1.5%)
⛁ Memory files: 5.1k tokens (2.6%)
⛁ Skills: 3.2k tokens (1.6%)
⛁ Messages: 25.2k tokens (12.6%)
⛶ Free space: 111k (55.3%)
⛝ Autocompact buffer: 33k tokens (16.5%)

Expected Behavior

/compact should succeed at 25% context usage (55% free space). If it fails at this level, auto-compact would likely also fail when it eventually triggers at ~83% usage, leaving users unable to compact at all.

Actual Behavior

/compact reports "Conversation too long" even though the context window is far from full. The error message is misleading since it implies a space issue, but the real constraint appears to be message structure/depth rather than token count.

Workaround

  • /clear to start fresh
  • Pressing Esc twice as suggested in the error, then retrying

Environment

  • Claude Code version: 2.1.42
  • Model: claude-opus-4-6
  • Platform: Linux

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗