/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

  1. Run a long session with many parallel subagents (in my case, ~15 agents updating i18n JSON files)
  2. Each agent completes and returns results, filling the context
  3. Context reaches ~96% full (4% remaining until auto-compact)
  4. Multiple agents show "Context limit reached · /compact or /clear to continue"
  5. Run /compact
  6. 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%"

View original on GitHub ↗

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