Skip to content

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

Open

Description

@xlsi

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?

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

Image

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

Activity

  1. added
    bugSomething isn't working
    on Jan 18, 2026
  2. github-actions commented on Jan 18, 2026

    @github-actions

    Found 3 possible duplicate issues:

    1. [BUG] Context percentage mismatch between /context, statusline API, and internal limit trigger #18241
    2. [BUG] Turning auto-compact OFF won't allow to continue until you fill the 200K tokens window anymore (it worked before). #18152
    3. [BUG] Auto compact off, but asking me to compact before 100% context usage #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

  3. abreufilho commented on Jan 18, 2026

    @abreufilho

    Same here. Clearly something changed from 2.1.6

  4. jmmirabile commented on Jan 18, 2026

    @jmmirabile

    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.

  5. OlaHulleberg commented on Jan 19, 2026

    @OlaHulleberg

    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

  6. HCYT commented on Jan 19, 2026

    @HCYT

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

  7. lutfi238 commented on Jan 20, 2026

    @lutfi238

    same issue with version 2.1.12 (Claude Code)

  8. mysehyunhope commented on Jan 20, 2026

    @mysehyunhope

    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.

  9. overkloud commented on Feb 15, 2026

    @overkloud

    even after /clear or restart of claude the issue persists
    Image

  10. seik commented on Feb 16, 2026

    @seik

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

  11. xcybplx commented on Feb 17, 2026

    @xcybplx

    The same here

  12. NathanR-85 commented on Feb 18, 2026

    @NathanR-85

    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.

  13. tandemloop commented on Feb 24, 2026

    @tandemloop

    happening in 2.1.44 as well still

  14. jakebromberg commented on Mar 3, 2026

    @jakebromberg

    Still happening with 2.1.63

  15. iJiaHaoZhong commented on Mar 17, 2026

    @iJiaHaoZhong

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

  16. Sayvai commented on Mar 19, 2026

    @Sayvai

    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.

    Image
  17. 0nly1ken0bi commented on Mar 28, 2026

    @0nly1ken0bi

    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.

  18. Sayvai commented on Apr 13, 2026

    @Sayvai

    @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"
    	},
    }
  19. ifzm commented on Apr 18, 2026

    @ifzm

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corebugSomething isn't workinghas reproHas detailed reproduction stepsmemoryplatform:macosIssue specifically occurs on macOS

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions