Repository navigation
Closed as duplicate
Labels
area:corebugSomething isn't workingSomething isn't workingduplicateThis issue or pull request already existsThis issue or pull request already existshas reproHas detailed reproduction stepsHas detailed reproduction stepsmemoryoncallplatform:macosIssue specifically occurs on macOSIssue specifically occurs on macOS
Description
Preflight Checklist
- I have searched existing issues and this hasn't been reported yet
- This is a single bug report (please file separate reports for different bugs)
- I am using the latest version of Claude Code
What's Wrong?
The /compact command fails with an error message stating "Conversation too long. Press esc twice to go up a few messages and try again." This prevents users from compacting their conversation history when the conversation becomes lengthy.
What Should Happen?
The /compact command should successfully compress the conversation history regardless of length, summarizing previous messages while preserving important context. Users should be able to compact conversations of any reasonable size to manage token usage and maintain conversation continuity.
Error Messages/Logs
Steps to Reproduce
- Start a new conversation in Claude Code
- Have an extended conversation with multiple tool calls, file reads, and edits (likely 50+ messages)
- Run the /compact command
- Observe the error: "Error during compaction:Error: Conversation too long. Press esc twice to go up a few messages and try again."
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
No response
Claude Code Version
1.0.111
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
No response
Reacted by Sven Lito, Bartłomiej Wołk, fostercalls, WebsiteMobil, Steven Fazzio, Katherine Driscoll, Derek King, Christian, Stian Grytøyr, Nemmy Amzel and 89 more
Metadata
Metadata
Assignees
Labels
area:corebugSomething isn't workingSomething isn't workingduplicateThis issue or pull request already existsThis issue or pull request already existshas reproHas detailed reproduction stepsHas detailed reproduction stepsmemoryoncallplatform:macosIssue specifically occurs on macOSIssue specifically occurs on macOS
Activity
PabloLION commentedon Sep 12, 2025
I see this too in the recent days. a lot of failures on /compact even when I'm at 25% (barely have no dialogue)
OMorris95 commentedon Sep 13, 2025
This has also been happening to me a lot recently. Pressing esc twice and going back messages also doesn't help and attempting to compact still brings the same error.
PabloLION commentedon Sep 13, 2025
I forgot this part. It happens more than 80% of the time. And when it happens, even I retry multiple times it still doesn't work.
And I also observed: when the context goes out of length, it seems a force /clear will happen, and we will be thrown to a new session, losing all the access to the old chat history. I know it stored somewhere in my file system, but it's not in the TUI.
TUstudents commentedon Sep 13, 2025
I can confirm this bug in 1.0.111
cahaseler commentedon Sep 14, 2025
Also seeing this issue on almost any manual compact, if I then add tons more context to force it to auto-compact at 100% of context, it works just fine. So clearly the issue isn't actually too many messages.
leichti commentedon Sep 14, 2025
Can confirm that as well. See it since a few days quite often, but seems to not effect the automatic compact
OMorris95 commentedon Sep 14, 2025
Haven't experienced the issue today, but when I was experiencing it, it was also affecting the auto compact. Currently on v1.0.113, not sure what version I was on when I had the issue yesterday.
PabloLION commentedon Sep 14, 2025
On my side it's also fixed. Guess we can close now.
It seems that in the new /compact does clear the history visually. Bugs are introduced in the implementation and are fixed now.
VirtualMaestro commentedon Sep 14, 2025
I got it now.
OS: Win 11
Claude Code: 1.0.113
Terminal: MINGW64 (Git/Bash)
117 remaining items
polat-mustafa commentedon Feb 10, 2026
Issue persists in v3.1.28.
Found a workaround: run /exit, use /resume to return to the affected chat history, and then run /compact. This seems to clear the bug for now.
phinolex commentedon Feb 10, 2026
Thanks @polat-mustafa for sharing this workaround! 🙌 The /exit → /resume → /compact sequence is a great temporary fix
ansonphong commentedon Feb 12, 2026
This bug is happening many times a day, just started happening recently.
Error: Error during compaction: Error: Conversation too long. Press esc twice to go up a few messages and try again.I'll try that work-around. It's getting very annoying.
welfvh commentedon Feb 12, 2026
Getting this all the time.
orenpa commentedon Feb 12, 2026
Getting this all the time.
switching to codex.. can't work with it
vladimir-trifonov commentedon Feb 14, 2026
junaidtitan commentedon Feb 18, 2026
One pattern I've noticed is that compaction failures correlate with session bloat — sessions packed with duplicate file reads, progress ticks, and large tool outputs are much harder for the summarizer to handle cleanly. I built cozempic to prune that dead weight before compaction triggers. Running
cozempic treaton a bloated session typically removes 40-70% of the noise, which in my experience makes compaction succeed where it was failing before.gonewx commentedon Feb 20, 2026
Still hitting this regularly. Failed compaction is one of the worst UX moments in Claude Code — you are told "context is low, run /compact" but then compact itself fails, leaving you stuck.
The real damage is not the error itself — it is losing the session context you spent time building. All the file knowledge, decisions, and debugging steps are effectively gone when you have to start fresh.
Two things that have helped me:
Would love to see the compact command become more robust, but in the meantime having a session safety net has saved me countless hours of re-explaining context to a fresh session.
Vinix24 commentedon Feb 25, 2026
The root problem here isn't compaction itself — it's that compaction is a lossy operation being asked to do lossless work. When it fails, you lose everything.
I sidestepped this entirely by rotating before compaction becomes necessary. A PreToolUse hook checks context usage on every tool call — at ≥65% it blocks the agent and instructs it to write a structured handover file (task state, files touched, progress, next steps). A PostToolUse hook detects the handover, then a detached script sends /clear via tmux and injects a continuation prompt into the fresh session.
The 65% threshold is the key insight: that's ~15 points before auto-compact kicks in at ~80%. Enough headroom for the agent to write a clean handover without racing against compaction.
The fresh session picks up the handover and knows exactly where to resume. No context lost, no "press esc twice" errors, no manual intervention. Works especially well for long multi-file sessions and agent workflows where compaction consistently chokes.
I open-sourced the setup recently — there's a dry-run replay you can run locally without needing an LLM to see the full lifecycle.
yurukusa commentedon Mar 24, 2026
While the compaction error is a core issue, you can protect against state loss with a PreCompact hook:
This runs before compaction happens, so even if compaction fails or loses context, you have a recovery file at `~/.claude/session-handoff.md`.
Install: `npx cc-safe-setup --install-example session-handoff`
For CLAUDE.md re-injection after compaction:
`npx cc-safe-setup --install-example reinject-claudemd`
junaidtitan commentedon Apr 3, 2026
The "Conversation too long" compaction error happens when the session has grown so large that even the compaction prompt itself exceeds the context window. The fix is to prune before compaction ever triggers.
Cozempic v1.4.1 does this automatically — the guard daemon monitors your session and runs pruning when token usage crosses thresholds. The PreCompact hook also fires a final prune pass right before Claude's native compaction, so it operates on a much smaller input.
17 strategies target different bloat sources: progress ticks (40-48% savings), thinking blocks, stale file reads, duplicate system-reminders, and the new
compact-summary-collapse(85-95% savings on compacted sessions).pip install cozempic && cozempic initIf anyone here is still hitting this, I'd appreciate hearing whether the guard daemon prevents the error from recurring.
claude commentedon Apr 27, 2026
This is a duplicate of #2038, which was fixed as of version 2.1.85.
github-actions commentedon May 4, 2026
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.