[BUG] Error during compaction
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] 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
I see this too in the recent days. a lot of failures on /compact even when I'm at 25% (barely have no dialogue)
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.
Pressing esc twice and going back messages also doesn't help
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.
I can confirm this bug in 1.0.111
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.
Can confirm that as well. See it since a few days quite often, but seems to not effect the automatic compact
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.
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.
I got it now. OS: Win 11 Claude Code: 1.0.113 Terminal: MINGW64 (Git/Bash)
+1
a workaround is to copy the conversation and remove all the pasted user messages manually, then paste it into a new session
It seems to me the first 1 2 or even 3 /compacts does work. But then it gets this error. Based on this, It seems to me they are now trying to compact the entire jsonl session file instead of the logs from the LAST /compact to present.
Fking Nightmaire, every time losing all context even compactin at 15% remaning, like start a new conversation every time needed to compact.
Been running into this constantly. Very annoying to deal with. 1.0.115 (Claude Code)
I’m experiencing the same issue, it’s pretty cringey.
I am experiencing this problem several times each day. I have taken to asking CC to write a detailed markdown summary of progress as I approach the context limit, so that I can regain context in the inevitable new conversation.
Just ran into this for the first time.
The problem seems to be fixed (for me at least) in the latest release 1.0.117
Still happening on 1.0.117 (it happened on both of my last two attempts to compact, in two different instances).
I'm on the max 20x plan. I wonder if the plan, and therefore likelihood of hitting limits, makes a difference ..
Same thing happened to me, only compacted once before this error. Used to be able to compact 4-5 times without any issues.
I tried to go back some messages up after that, and that didn't help either.
Claude Code v1.0.115
L Session ID: 9df6a061-806e-4c89-905b-4224a9e084ba
Edit: somehow the screenshot got cut (?). On the top of it before status there was
/compact
⎿ Error: Error during compaction: Error: Conversation too long. Press esc twice to go up a few
messages and try again.
First time i've noticed this issue but identical presentation as previously described - i'm on Debian
happened today in .117 - still an issue. it should just work
When are we going to resolve this, it's been like this for the past week
Have similar issue on v1.0.119. One consistent workaround I've been using the past few days is to kill the claude code instance and then restart with claude --continue. Afterwards, the compaction command seems to work.
Have similar issue on v1.0.119. One consistent workaround I've been using the past few days is to kill the claude code instance and then restart with claude --continue. Afterwards, the compaction command seems to work.
This is the way to do it. It seems to happen after two full sessions (I'm on 20x max) where I've compacted once (sometimes twice) already. But closing and resuming will allow it to compact again. Definitely a bug since compacting works, just not after a longer conversation.
Yeah have been facing this issue a lot since a day or couple of days maybe. BUT yeah closing and resuming the session works, weird, I wonder whats the logic going on behind /compact that causes this regression so rarely
Have similar issue on v1.0.119. One consistent workaround I've been using the past few days is to kill the claude code instance and then restart with claude --continue. Afterwards, the compaction command seems to work.
This is the way to do it. It seems to happen after two full sessions (I'm on 20x max) where I've compacted once (sometimes twice) already. But closing and resuming will allow it to compact again. Definitely a bug since compacting works, just not after a longer conversation.
Doing this you will remove context, as --continuing only loads the conversation, not the context. But if that's all good, you can just do: /clear /resume - this will loads the convo /compact - > no need to close claude code
"sometimes" it works after restarting the claude instance, fyi.