[BUG] Error loop between 'context low' and '/compact'
Resolved 💬 49 comments Opened Jun 13, 2025 by zxdxjtu Closed Apr 18, 2026
💡 Likely answer: A maintainer (sid374, contributor)
responded on this thread — see the highlighted reply below.
Environment
- Platform (select one):
- [ ] Anthropic API
- Claude CLI version: 1.0.17
- Operating System: macOS 12
- Terminal: normal
Bug Description
⎿ Context low · Run /compact to compact & continue
/compact
⎿ Error: Error during compaction: Error: Conversation too long. Press esc to go up a few messages and try again.
<img width="942" alt="Image" src="https://github.com/user-attachments/assets/e4170bc1-6076-4814-b7f4-4c81e81171d7" />
Steps to Reproduce
- <!-- First step -->
- <!-- Second step -->
- <!-- And so on... -->
Expected Behavior
<!-- What you expected to happen -->
Actual Behavior
<!-- What actually happened -->
Additional Context
<!-- Add any other context about the problem here, such as screenshots, logs, etc. -->
49 Comments
same here, cant get out of it. I followed the instructions esc, went up a few messages to find a large message I pasted a bunch into, i deleted the large paste, reformatted my message and tried again, still stuck.
Same experience. Then got rate limited 💀
Confirmed on
Environment
Same deal here.
Similar to #42 - which has been active again.
Same here
Same here
same here
same here
same here, any solution?
I was able to unlock with
/clear.@agustin107 you ran
/clearand then were able to continue the conversation? I tried that, but it went back to the "run /compact" message.fwiw: I was encountering this issue in vs code. I quit and started
claudein terminal. From there, I was able to get out of the loop.I was able to resolve this by clearing out
~/.claude/projectsand~/.claude/todos. Note: this is a destructive action and will remove existing data.me too
Experiencing the same issue. All the suggested solutions don't work for me. Can't use Claude Code at all.
For me restarting helped for now.
Same here too
on macOS :
<img width="850" height="300" alt="Image" src="https://github.com/user-attachments/assets/8823311c-7635-4879-b5c9-7b4440539aa2" />
Also experiencing this
same here
⎿ Context low · Run /compact to compact & continue
⎿ Error: Error during compaction: Error: Conversation too long. Press esc to go up a few messages and try again.
Connection: Claude Code Max
Claude Version: 1.0.81 (Claude Code)
Terminal: built-in Terminal / IntelliJ IDEA terminal
OS: macOS 15.6
@here - ok everyone: very simply - vibe coding the CLI is super cool. But, a set of strong validation to a) ensure invalid UTF-8 doesn't get in the jsonl files and b) have a basic recovery mechanism when the context length being compacted went over the high water mark is... completely doable my dear friends at Anthropic. For everyone else go read Empire of AI - it'll give you a little more context as to why the folk at Anthropic are working there instead of at other positions.
Thanks for the report. Couple questions:
/bugand upload their transcript + share the feedback_id here -> this would greatly help with debuggingHi there,
same here
⎿ (no content)
⎿ Context low · Run /compact to compact & continue
⎿ Compacted. ctrl+r to see full summary
still having problem: Context low · Run /compact to compact & continue
same here
I had this happening today too. Opening a brand new session, context would be mostly empty as normal.
<img width="906" height="286" alt="Image" src="https://github.com/user-attachments/assets/7356643e-8e4d-4a75-b431-ab13da0783fd" />
But as soon as I pasted in my prompt which I had been writing in Apple Notes, Claude was immediately at >100% context window usage.
<img width="850" height="341" alt="Image" src="https://github.com/user-attachments/assets/26c91255-751a-4046-bd58-75fb6807b370" />
/cleardid nothing and/compactwould fail as in OP's message.I was eventually able to recover by re-processing my prompt (which was only 4 paragraphs of text long!). I noticed that when I first pasted it into Cursor, I got this warning.
<img width="254" height="345" alt="Image" src="https://github.com/user-attachments/assets/104e1bfe-bd58-4b37-91cd-a3ce25ad1795" />
So I removed the line terminators and then asked Cursor to reformat the document for me. It did a minimal tidy up to format it as Markdown, but it must've cleared up some weird encoding issue. Pasting the result into a new session allowed Claude to keep going.
Done: Feedback ID: 5f378575-474a-428c-80e8-cc6032a3b8fa
Im having this issue, and I think it relates to the PostToolUse hook Ive setup, and if the issue is in there it doesnt autocompact, does that tally?
Both times it looked like :
/clear resolve
/init fixes this without clearing your work
I have tried /clear and /init and /compact but nothing works
i experience the same thing. No tool use
Anthropic Max Plan
Claude CLI version: 2.0.31
Operating System: Windows 10
Terminal: Windows Terminal / WSL Ubuntu
The response from your hooks enters context. If the hook response is longer than your remaining context then you'll end up with the issue ( I have not definitely proved this, but this seems correct :) ). Good luck
I experience this without any post tool hooks.
I experienced this today as well.
Same issue here, seems to be reported in a LOT of different issues in various ways. Mostly related to sub agents polluting context of main agent in some way causing main agent to have context that is 100+% total allowed which causes compact to fail
Still happening. Happens multiple times a week. Come on, guys. Get this fixed.
Additional reproduction cases (Jan 2026)
Still encountering this bug frequently:
Case 1: Parallel sub-agents
Case 2: Background bash command (not sub-agents)
Key observations:
/compactdoesn't work in this state/feedbackalso fails with "Error submitting feedback / bug report"Environment: Windows 11, Node.js v22.12.0
New reproduction: API Error 400 due to tool use concurrency issues
When running 2 parallel Bash agents (overnight pipeline + EOD pipeline), after both completed successfully:
On the next user message, got:
This may be related to the compaction loop - user also saw "max compactions exceeded" error flash in the same session before this occurred.
Additional Report - Claude Desktop on Windows
Platform: Claude Desktop (latest), Windows 10/11
Date: January 30, 2026
Experiencing this consistently on Claude Desktop. The send button silently fails when context is high — message disappears with no error, no compaction attempt, nothing. Have to kill and restart the session.
This compounds with other Desktop issues:
The combination makes Desktop nearly unusable for long coding sessions: you can't trust the usage meter, sending silently fails with no feedback, and if compaction kicks in it may destroy your context anyway.
Would love to see either a proper error message when send fails, or a reliable auto-compact that preserves instructions.
Another Instance - "This isn't working right now"
Platform: Claude Desktop (latest), Windows
Date: February 3, 2026
New error variant: when compaction triggers, Desktop now shows "this isn't working right now" and fails completely. No compaction occurs, session is stuck.
This is a different failure mode from the silent send failure reported earlier — at least this one shows an error message, but the result is the same: dead session requiring restart.
Another Instance - "Response could not be fully generated"
Platform: Claude Desktop (latest), Windows
Date: February 3, 2026
Yet another compaction failure variant. This time the error message is: "Claude's response could not be fully generated"
That's three different failure messages for the same root cause in recent sessions:
All result in a dead session requiring restart.
Another Compaction Failure Variant - "Exceed length limit"
Platform: Claude Desktop, Windows
Date: February 5, 2026
New error message variant:
This is now the fourth distinct failure message for compaction issues on Desktop:
All result in dead sessions. The system clearly knows it needs to compact but fails to do so, offering no recovery path except "start over."
Stephen Wilkey
Technology Business Partner
,
Hammond Innovations
E: @.****@.>
|
P: +61 4 0314 9968<tel:+61%204%200314%209968>
|
M: +61 4 0314 9968<tel:+61%204%200314%209968>
Level 3-4, Building B, 207 Pacific Highway, St Leonards NSW 2065
www.hammondinnovations.com.au<https://au.content.exclaimer.net?url=https%3A%2F%2Fwww.hammondinnovations.com.au%2F&tenantid=NLIqmlkoEe-9_QAiSJJmVA&templateid=c30a519ef0cff0118196000d3a6a926d&excomponentid=W6bvJgBHL5FBYT6xWR9Anzifg5rdKo0fyvzt4Y4wwko&excomponenttype=Link&signature=AmlzhjMIVXQAHP8VBQ79IQ0zZB6V895Gu-Nz6Ari1tOAQQuqIL7Yw1xJpHphLzt0YS7OlA0YNao7jfAsCq5h16vncMH00Iq3pITjv87-vStBdxQiUC0FuOc6d-L0mcYK10PD-AWibGGezQ2kx57NzMfaayhwAmrAYEQkOXs-pnwU0cx1NallDUWJBd6r2LnuB203WKYXWVOKxwzHyK4DAUxRqkFJNHNXCX33D2YtF4SH9J5sVdjwDxjy4T61VoiTqkFoeNZ8RKMwy5YegKMJENnWOhuFVoePCodcHmSSO60qHVRRsjb6aCVrJ4EpST9hS_iwi799s6SbhiCO_afveg&v=1>
[Donate to The HammondCare Foundation]<https://au.content.exclaimer.net?url=https%3A%2F%2Fwww.hammond.com.au%2Fdonation%3Futm_campaign%3DFND%2520%257C%2520UTM%2520tracking%2520%257C%2520ongoing%26utm_source%3DeSig-FND-INN-teams&tenantid=NLIqmlkoEe-9_QAiSJJmVA&templateid=c30a519ef0cff0118196000d3a6a926d&excomponentid=DrtkSx3cZqq7fSC5xJbF3nGQTvVtBPK8SFLLYoLtW7o&excomponenttype=Image&signature=VeiSpYdgwwCMr5vzYChV3spKkR-DYu9EmTYRJIMWsnj-po64G2VGpQkqaSewrBddjiMPbX0bEX-iZubi5gQATj7O5r0Kgt3UIR-RBBOnZbL4u1FTcSylug0Rtu95Pb0LLHDcrA4QEEuxa9Fy6GG2hMy_QY1GiE1_s9BM9OhWeCFi_UkqVdo31hXbu3SCgStRB-NSc9Fq4o97l4JPlDwxYGBws953aSiPMJb-2MJD-aF1R5V6G50cfoMT6steHe_mSy6v5Pqfvc_zaWZvh2iIoTI2r5KIYUwtZnqN-8HmP-ZxIVVfKZXHuaIt7uyB5NzZZgArmP0R4xUB96Ybqsu0Jw&v=1>
________________________________
From: ThatDragonOverThere @.*>
Sent: Friday, 6 February 2026 05:26
To: anthropics/claude-code @.*>
Cc: Stephen Wilkey @.>; Comment @.**>
Subject: Re: [anthropics/claude-code] [BUG] Error loop between 'context low' and '/compact' (Issue #2038)
[https://avatars.githubusercontent.com/u/168599305?s=20&v=4]ThatDragonOverThere left a comment (anthropics/claude-code#2038)<https://urldefense.com/v3/__https://github.com/anthropics/claude-code/issues/2038*issuecomment-3855148789__;Iw!!PRoTsabzKIOu!S4AJL8Y706lPE4W_PNCs9Ct28tXXnGsjNzvnO2pOlk7n3UanIbkJJzzAbpJ6WnmgbDKj4Yxwz9fL8vzR521RHlh2NkI$>
Another Compaction Failure Variant - "Exceed length limit"
Platform: Claude Desktop, Windows
Date: February 5, 2026
New error message variant:
"Your message will exceed the length limit for this chat. Try attaching fewer or smaller files or starting a new conversation"
This is now the fourth distinct failure message for compaction issues on Desktop:
All result in dead sessions. The system clearly knows it needs to compact but fails to do so, offering no recovery path except "start over."
—
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https://github.com/anthropics/claude-code/issues/2038*issuecomment-3855148789__;Iw!!PRoTsabzKIOu!S4AJL8Y706lPE4W_PNCs9Ct28tXXnGsjNzvnO2pOlk7n3UanIbkJJzzAbpJ6WnmgbDKj4Yxwz9fL8vzR521RHlh2NkI$>, or unsubscribe<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/BBIRSJBRLEZR7NEIYWPUV5L4KODO7AVCNFSM6AAAAAB7G4YKLOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTQNJVGE2DQNZYHE__;!!PRoTsabzKIOu!S4AJL8Y706lPE4W_PNCs9Ct28tXXnGsjNzvnO2pOlk7n3UanIbkJJzzAbpJ6WnmgbDKj4Yxwz9fL8vzR521R7M4Df4E$>.
You are receiving this because you commented.Message ID: @.***>
This email and all attachments are for the recipient only and may contain confidential information. If you have received this message in error, we kindly request that you do not use the information in any way, and please let the sender know immediately and delete the email.
This issue highlights a fundamental limitation: when context gets too long, you are stuck in a lose-lose situation. Compact fails, and you cannot continue working.
The real cost here is not just the interrupted session — it is all the context you built up (decisions, file knowledge, debugging steps) that gets lost when you have to start fresh.
One approach I have found helpful: use Mantra to snapshot sessions before they hit the context limit. When compaction fails, you can go back to any earlier point in the session and branch from there — keeping the context that matters without hitting the limit.
It does not fix the compact bug itself, but it means a failed compact no longer means "start over from scratch."
/tmp/gh-comment-2038.md
v2.1.87 — context limit + rate limit = complete lockout. Two bugs compound into session death.
Reproducing on v2.1.87, Windows, Max plan:
@"bug-reporter (agent)"to delegate — returned "Context limit reached · /compact or /clear to continue"/compact— returned "Error: Error during compaction: Error: API Error: Rate limit reached"The compaction itself is being rate-limited. So the user has:
/clearand lose everythingv2.1.85 fixed
/compactfailing when the conversation is too large for the compact request to fit. This is the inverse: the compact request fits, but it's being rate-limited at the API layer. Combined with #37394 (rate limits burning 5-10x faster than normal since Mar 16), compaction is now failing not from context size but from rate limiting.When compaction itself is rate-limited, the context window is a dead end. There is no recovery path that preserves session state.
System: Windows 11, Node.js, v2.1.87, Max plan
This was fixed in v2.1.85 — /compact now retries with the oldest messages dropped when the compact request itself is too large, instead of failing with 'Conversation too long'. If you're still seeing this in the latest version, please comment with your version and repro and we'll reopen.
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.