claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

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.

Open peixotorms opened this issue 1 year ago • 31 comments

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.

peixotorms avatar Jul 20 '25 01:07 peixotorms

The same here. And previously, bigger files were not the problem. Was something changed?

Antonytm avatar Jul 23 '25 14:07 Antonytm

facing the same issue

Anubhav-Rai avatar Jul 28 '25 15:07 Anubhav-Rai

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.

blevinson avatar Jul 29 '25 01:07 blevinson

same issue

Baldman-JYH avatar Aug 01 '25 02:08 Baldman-JYH

same issue

hqman avatar Aug 01 '25 08:08 hqman

I hade the same issue but with MCP tools. I could assume context provider MCPs encounter this limit more often.

Image

mahmoudmoravej avatar Aug 01 '25 16:08 mahmoudmoravej

This is really frustrating, makes using mcp feel useless. I'm on claude max 20x Image

mrrobotke avatar Aug 02 '25 18:08 mrrobotke

RTFM, the MCP maximum token limit can be configured in the env configuration section.

jaens avatar Aug 02 '25 21:08 jaens

Hello, how do I set it up through env?

RTFM, the MCP maximum token limit can be configured in the env configuration section.

hqman avatar Aug 05 '25 07:08 hqman

export MAX_MCP_OUTPUT_TOKENS=50000 or whatever limit. I read somewhere the 5x Max plan has - 88K token limit and 20x Max - 200K token limit

shubhamgupta731 avatar Aug 05 '25 07:08 shubhamgupta731

please 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.

zurferr avatar Aug 05 '25 12:08 zurferr

previously was a env var to set the context size why it was removed? pls add it again

namenmalkav avatar Aug 08 '25 05:08 namenmalkav

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.

EvolvingSoftware avatar Aug 10 '25 20:08 EvolvingSoftware

same issue 😡

dunktra avatar Aug 21 '25 07:08 dunktra

what we do about this now?

an0ymOnTelegram avatar Aug 24 '25 11:08 an0ymOnTelegram

same - whenever I start a simple project my context already filled in with 50,000 tokens. I didn't see this issue before

artnikbrothers avatar Aug 24 '25 17:08 artnikbrothers

export MAX_MCP_OUTPUT_TOKENS=50000 or whatever limit. I read somewhere the 5x Max plan has - 88K token limit and 20x Max - 200K token limit

this works fro MCP tools, but we need one for files and context

mrrobotke avatar Aug 24 '25 19:08 mrrobotke

Given 1M token context size, it should really allow larger files if user wants to pay

csaftoiu avatar Sep 03 '25 09:09 csaftoiu

we have paid the MAX plan, it still limit our file read token!!!!

Mon-ius avatar Sep 04 '25 14:09 Mon-ius

I just did:

cd ~/.npm-global/lib/node_modules/@anthropic-ai/claude-code
sed -i 's/25000/100000/g' cli.js

And then in claude:

/model sonnet[1m]

And it looks like it works for me.

mitar avatar Sep 10 '25 21:09 mitar