[BUG] Context limit reached · /compact or /clear to continue

Open 💬 18 comments Opened Jan 18, 2026 by xlsi

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?

Auto-compact is off, but claude stops when there are still 30% context left.

<img width="2680" height="348" alt="Image" src="https://github.com/user-attachments/assets/63b704a8-9614-4b9c-9987-2ce7ce25f397" />

What Should Happen?

It should allow me to keep working with the warning showing but non-blocking

Error Messages/Logs

Steps to Reproduce

  1. turn off auto-compact,
  2. use 2.1.7 and above version.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.6 (Claude Code)

Claude Code Version

2.1.12 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

18 Comments

github-actions[bot] · 5 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/18241
  2. https://github.com/anthropics/claude-code/issues/18152
  3. https://github.com/anthropics/claude-code/issues/18314

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

abreufilho · 5 months ago

Same here. Clearly something changed from 2.1.6

jmmirabile · 5 months ago

This is EXTREMELY frustrating and break causing. This happened in the middle of a refactoring. After running "/compact", I started Claude again, instructed Claude to read the CLAUDE.md, the code and notes, it then ignored other parts of the deployment and did some extra stuff. Then after discussing and reading thru what it broke, the usage limit hit. Then, I did some other things, waited two hours and started again. And again, despite Claude stating it understood what to change, it did something different. And then while researching what it did and discussing why, I ran into the usage limit again! I just wasted two hours with no progress because compacting happens in the middle of coding, Claude looses context and then again when the usage limit is reached! I hate complaining, Claude helped me make incredible progress in two days, but to just stop in the middle of a refactoring, wow! That's not cool.

OlaHulleberg · 5 months ago

it seems like Claude Code has stopped parsing message_delta events from the API, and instead bases it's usage on ONLY message_start instead

HCYT · 5 months ago

I’m experiencing the same issue—Claude asks me to compact even with over 30% context remaining.

lutfi238 · 5 months ago

same issue with version 2.1.12 (Claude Code)

mysehyunhope · 5 months ago

same issue. 2.1.12, windows native.
auto-compact : false,
but it seems that it started happening since i used /compact,
any way, i found a workaround on reddit: setting CLAUDE_CODE_BLOCKING_LIMIT_OVERRIDE="197000" in powershell.
or just u can go back to 2.1.6 or 2.1.2.
it's just a temporary tweak.
i hope this bug gets fixed ASAP.

overkloud · 5 months ago

even after /clear or restart of claude the issue persists
<img width="911" height="531" alt="Image" src="https://github.com/user-attachments/assets/81ca03f5-0bc6-415c-8f95-23b8ecb7d722" />

seik · 5 months ago

This is happening quite often to me now. v2.1.42

xcybplx · 4 months ago

The same here

NathanR-85 · 4 months ago

Keeps happening to me, doesn't matter if auto-compact is on or off (it's been on though). Right now I'm at 65% and can't even compact.

It only happens when I have subagents. Maybe they're trying to bring in too much context, but I told them to write-to-file and bring back minimal context ("done").

Not only is it annoying, but it's wasting so many tokens.

tandemloop · 4 months ago

happening in 2.1.44 as well still

jakebromberg · 4 months ago

Still happening with 2.1.63

iJiaHaoZhong · 4 months ago

v2.1.74 allway on,but i open 1M context mode

Sayvai · 3 months ago

I'm on the latest Claude Code version (2.1.79), and am still getting the error; "Context limit reached · /compact or /clear to continue" when i try the next prompt even though my sessions' context usage is like roughly 190,000 / 1,000,000, using the model Opus 4.6 (1M context). It's a clear bug 🐞, and it has been going on since previous versions too, where I was hoping the bug would be fixed by now.

I shouldn't need to action the suggested slash commands (/compact, /clear) when i am well within my sessions' context window limit, especially when using a 1M model.

<img width="1126" height="426" alt="Image" src="https://github.com/user-attachments/assets/8ad6ce52-4de3-4b4a-8c54-cffee0980d5e" />

0nly1ken0bi · 3 months ago

Solution

I've just ran into this issue after my first local install and I think I've come across a solution that at least worked for me.
I'm using the latest version.

running /compact wouldn't work
running /rename wouldn't work
running /config auto compact wouldn't work

I then ran /context and noticed I had only used 75% of my tokens.

I then pressed ESC a few times to bring up the Rewind History and then simply just scrolled back up to where I first got the limit message and simply resubmitted my last request and presto I could continue to work without getting that message limit notification.

Hopefully this can help someone work around this bug.

Sayvai · 3 months ago

@bcherny @ThariqS - this is issue is still happening to this day, and very frequently, even after all the CC version iteration updates. Can this issue also be looked at?

Reaching apparent rate limit reached error, and having to manually compact my session at around 167k tokens used on the Opus 4.6 (1M context) model just now is not right.

Are we (the affected) missing something?

I even applied these other environment variables to my settings.json, to try and mitigate against the issue, but to no avail:

{
	"env": {
	    "CLAUDE_CODE_BLOCKING_LIMIT_OVERRIDE": "1000000",
	    "CLAUDE_AUTOCOMPACT_PCT_OVERRIDE": "90"
	},
}
ifzm · 2 months ago

Encountered the same problem and could not execute the command /compact, only /clear 🙍‍♂️