[BUG] Error loop between 'context low' and '/compact'
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.
Steps to Reproduce
Expected Behavior
Actual Behavior
Additional Context
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
- Connection: Claude Code Max
- Claude Version: 1.0.24 (Claude Code)
- Terminal: Windows Terminal
- OS: Ubuntu 24.04.2 LTS
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 /clear and 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 claude in terminal. From there, I was able to get out of the loop.
I was able to resolve this by clearing out ~/.claude/projects and ~/.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 :
Also experiencing this
> /compact
⎿ Error: Error during compaction: Error: API Error: 400 {"type":"error"
,"error":{"type":"invalid_request_error","message":"input length and
`max_tokens` exceed context limit: 199544 + 20000 > 200000, decrease
input length or `max_tokens` and try again"}}
> /compact make sure you do not exceed context limit
⎿ Error: Error during compaction: Error: API Error: 400 {"type":"error"
,"error":{"type":"invalid_request_error","message":"input length and
`max_tokens` exceed context limit: 199714 + 20000 > 200000, decrease
input length or `max_tokens` and try again"}}
> /compact
⎿ Error: Error during compaction: Error: API Error: 400 {"type":"error"
,"error":{"type":"invalid_request_error","message":"input length and
`max_tokens` exceed context limit: 199867 + 20000 > 200000, decrease
input length or `max_tokens` and try again"}}
same here
⎿ 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.
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:
- Do you guys have auto-compact switched off?
- If anyone is able to
/bugand upload their transcript + share the feedback_id here -> this would greatly help with debugging
Thanks for the report. Couple questions:
- Do you guys have auto-compact switched off?
- If anyone is able to
/bugand upload their transcript + share the feedback_id here -> this would greatly help with debugging
Hi there,
- When I posted it above, it happened the once randomly during auto-compact.
- i don’t have that available, but will do so if it happens again.
same here
/clear ⎿ (no content)
claude usage ⎿ Context low · Run /compact to compact & continue
/compact ⎿ 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.
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.
/clear did nothing and /compact would 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.
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.
2. bug
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 :
⎿ Hook PostToolUse:Write completed
⎿ Context low · Run /compact to compact & continue
/clear resolve
/init fixes this without clearing your work