Error: File content (28375 tokens) exceeds maximum allowed tokens (25000). Please use offset and limit parameters to read specific portions of the file, or use the GrepTool to search for specific content.
Resolved 💬 31 comments Opened Jul 20, 2025 by peixotorms Closed Dec 2, 2025
💡 Likely answer: A maintainer (catherinewu, contributor)
responded on this thread — see the highlighted reply below.
I am using sonnet and claude code.
Reading some files I get something like this:
Error: File content (28375 tokens) exceeds maximum allowed tokens (25000).
Please use offset and limit parameters to read specific portions of the file, or use the GrepTool to search for specific content.
While I understand there is some reasoning for this, why is the limit 25000 when Sonnet supports 64000 and Opus 32000? Shouldn't it detect which model is in use and let it use it up to the limit, or ate least higher for Sonnet?
How about context?
We have a 200k context, but is it used by claude code?
I am loading a small codebase that should be not anywhere near the 200k but apparently, it fills context very quickly.
Kindly allow us to use the full context and max_tokens available, don't hardcode those things.
31 Comments
The same here. And previously, bigger files were not the problem. Was something changed?
facing the same issue
Same. Please advise! This is a severe limitation! We can't even get playright screenshots for that small???
playwright - Wait for (MCP)(time: 3) ⎿ Error: MCP tool "browser_wait_for" response (45599 tokens) exceeds maximum allowed tokens (25000). Please use pagination, filtering, or limit parameters to reduce the response size.
same issue
same issue
I hade the same issue but with MCP tools. I could assume context provider MCPs encounter this limit more often.
<img width="720" height="136" alt="Image" src="https://github.com/user-attachments/assets/0da9f165-9e3e-4ab8-a730-2338aa4b90df" />
This is really frustrating, makes using mcp feel useless. I'm on claude max 20x
<img width="959" height="147" alt="Image" src="https://github.com/user-attachments/assets/b9047b50-a60c-46ea-ae51-3d11c3631c7f" />
RTFM, the MCP maximum token limit can be configured in the env configuration section.
Hello, how do I set it up through env?
export MAX_MCP_OUTPUT_TOKENS=50000or whatever limit. I read somewhere the 5x Max plan has - 88K token limit and 20x Max - 200K token limitplease allow us to manually set it higher if you don't want to increase the default 🙏 50k would already help a lot in my case.
previously was a env var to set the context size why it was removed? pls add it again
I've the same issue. Unfortunately working on a C driver and have limitations breaking the file up. Claude scanning through without being able to load the whole file, makes it look like it really doesn't understand what the file is doing and makes significantly more mistakes. Qwen code for instance, handles this totally fine.
same issue 😡
what we do about this now?
same - whenever I start a simple project my context already filled in with 50,000 tokens. I didn't see this issue before
this works fro MCP tools, but we need one for files and context
Given 1M token context size, it should really allow larger files if user wants to pay
we have paid the MAX plan, it still limit our file read token!!!!
I just did:
And then in claude:
And it looks like it works for me.
Same issue
For windows users, you just need to add the CLAUDE_CODE_MAX_OUTPUT_TOKENS in environment variable screen as shown in the screen shot
<img width="1050" height="727" alt="Image" src="https://github.com/user-attachments/assets/13cadc07-7e82-4793-a0f5-c1e31cf67b83" />
You're clever.
I'm really struggling too. I'm unable to fully utilize Sonnet 4.5's performance.
If you change the model to sonnet[1m] you an only use Sonnet 4 though, right?
I've encountered the same issue, which may be related to the Opus 4.5 model.
Bonjour
Same issue here. I try to read ms_rust_core_guidlines.txt from Microsoft in a SKILL. It reports :
I contacted the guys maintening the core guidelines and they already said that the file will grow not shrink
I use Windows 11, Powershell and VSCode with Claude Code in a Pro Plan
I don't know what to do because I don't know if the advises above are still valid today
Regards
Hi - Wanted to explain our reasoning for this behavior. We limit the number of lines that Claude Code can read at a time since we noticed that sometimes Claude Code would read extremely long files that would eat up the entire context window and cause compaction, which frustrated users. To mitigate this, we warn Claude Code when it's going to read a long file so that it can decide either to read a subset of the file or to read the whole thing. It can still read the entire file by sending more than one read file request with different line start/end points. Hope that helps explain it!
If you're having issues with MCP, could you open a new issue so that we can keep this thread focused? Thank you!
@catherinewu Could this limit be a setting? Or even to confirm with the user? I would prefer that if I ask Claude Code to read the whole file before continuing, that it can do that. Not that it is unable to do it. Maybe get a confirmation from me like it gets when running extra tools.
This is also related to #5644. With #5644 we would not have to worry so much about "eating whole context" at all.
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.