Read tool sends requests exceeding 20MB API limit without pre-checking payload size

Open 💬 30 comments Opened Feb 16, 2026 by tonimelisma

Bug Description

When using the Read tool to read multiple PDF files in a single turn (4 PDFs), Claude Code sends the request without checking whether the cumulative payload exceeds the 20MB API limit. The request fails with:

Request too large (max 20MB). Double press esc to go back and try with a smaller file.

Expected Behavior

Claude Code should validate the cumulative payload size before making the API call. Options:

  • Pre-check file sizes before reading and refuse/split if total would exceed the limit
  • Read files incrementally and stop before hitting the limit
  • At minimum, gracefully handle the error by retrying with fewer files automatically

Steps to Reproduce

  1. Have multiple large PDF files in the project (4 PDFs totaling >20MB)
  2. Claude Code attempts to read all 4 files in a single turn via the Read tool
  3. The API request exceeds 20MB and fails

Actual Behavior

The Read tool blindly attempts to send all file contents without checking cumulative size, hitting the 20MB wall and failing.

Environment

  • Claude Code version: 2.1.42
  • OS: macOS (Darwin 25.2.0 arm64)
  • Node.js: v25.4.0
  • Model: Claude Opus 4.6

Additional Context

This bug is compounded by a related issue where the resulting error crashes the conversation with no recovery path (filed separately).

View original on GitHub ↗

30 Comments

github-actions[bot] · 5 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/13823
  2. https://github.com/anthropics/claude-code/issues/22699
  3. https://github.com/anthropics/claude-code/issues/8092

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

Eshtrik · 4 months ago

i also have this error.

Trangle · 4 months ago

me too

littlejohntj · 4 months ago

this is happening to me over time as well. the "file size" accumulates with a bunch of smaller images returned over an MCP and Claude Code neglects to prune them and / or intelligently decide what goes in

plmelancon · 4 months ago

Issue happens on Windows too. Not only MacOS

mrbeandev · 4 months ago

did anyone find any fix for this ??

i am on linux mint os , and have the same issue !
● Request too large (max 20MB). Double press esc to go back and try with a smaller file.

pablosanzo · 4 months ago

I'm getting this every day now with the 1M context window

gabdevbr · 4 months ago

I'm getting this every time 😭 with small size files

iamk3nnyt · 3 months ago

Issues happening consistently. I'm on max plan. I urge everyone to downgrade when possible and look at switching providers

MMEurope · 3 months ago

Same issue here. Can't continue my session anymore. Whenever I send a new message I just get the same error.

LewAdvSol-Ian · 3 months ago

Joining this party since I can't really get much work done without hitting this very stupid error. Idk what happened but claude today is not the claude I was working with yesterday. Drastically dumbed down.

404Utopia · 3 months ago

this shit is genuinely pathetic man i cant fucking stand anthropic @bcherny get your fucking head out of your ass you clown

eduwass · 3 months ago

@claude fix this bug plz, make no mistakes

ahoydig · 3 months ago

@claude this is pretty annoying

mhdabdullah204 · 3 months ago

Request too large (max 20MB). Double press esc to go back and try with a smaller file. hey claude can u please fix this

PlanetIrata · 3 months ago

Request too large (max 20MB). Double press esc to go back and try with a smaller file.

Please fix this !

brunorilla · 3 months ago

I'm getting the same over here. Please fix. Even while sending a short message.

litterthanlit · 3 months ago

same here

bdavison98 · 3 months ago

I get this pretty often while using the playwright mcp

cosly · 3 months ago

Max plan user ($200/mo) — this is a daily blocker

I'm hitting this bug multiple times per day as a Max plan subscriber. The irony is brutal: the users paying the most are the ones most affected, because we're the ones running longer, heavier sessions — which is exactly what we're paying for.

The real damage isn't the error — it's the aftermath

The error itself is annoying, but the actual cost is what happens next:

  1. Conversation bricks — every subsequent message fails with the same error. No recovery possible.
  2. Forced to /clear — which nukes all conversation context.
  3. The AI gets significantly dumber after clearing — it loses all accumulated understanding: decisions made, approaches rejected, preferences learned during the session, the mental model of how things connect. Compaction summaries are lossy. /clear is a full lobotomy.
  4. Work slows to a crawl — I spend time re-explaining context that was already established, re-correcting mistakes the AI had already learned not to make.

The trigger is deceptive

The error message blames the current file/image, but the real cause is accumulated conversation payload silently approaching the limit. A 99KB PNG or a short text message tips it over. Users can't predict or prevent it because there's no visibility into how close you are to the limit.

What needs to happen

  • Pre-validate payload size before sending to the API — don't brick the conversation
  • Graceful degradation — if approaching limits, auto-compact or warn the user before it's too late
  • Transaction rollback — if the API rejects, roll back to the previous state instead of corrupting the session
  • Accurate error messaging — "Context too large, try /clear or /compact" instead of blaming a small file

This is a paying customer telling you: this single bug is the #1 thing degrading my experience with Claude Code. Not missing features, not model quality — this. Please prioritize it.

pablosanzo · 3 months ago

This is so neglected that the notifications of new comments in the GitHub issue are now as annoying as the issue itself

mhdabdullah204 · 3 months ago

Can everyone please tag @bcherny on X regarding this issue? This is quite urgent. As a paying user on the $100 plan, I’m experiencing this repeatedly, and it’s impacting usage significantly. Would really appreciate

pablosanzo · 3 months ago

The best is if they made the agent harness open source so we could fix these ourselves (there are some already)

Otherwise we will need to build our own harness (not to mention our own open weights models)

LewAdvSol-Ian · 3 months ago

OK it is, and you can create you own harness. Coming from a frequent rage poster, this is manageable by a well made harness, optimizing MCPs, controlling context bloat, and just restarting the session after it creates a comprehensive hand-off. Have it audit, have another agent audit it against the conversation and move on. You can only expect so much from this awesome tool. After doing those things and restarting my sessions more frequently, 0 instances of this issue. Not to say it does not still exist but it is entirely manageable while they sort it out.

I would still take this over gemini's hack and slash harness.

bdavison98 · 3 months ago

Interesting, I’ll keep this in mind. Thanks

On Wed, Mar 25, 2026 at 12:02 PM LewAdvSol-Ian @.***>
wrote:

LewAdvSol-Ian left a comment (anthropics/claude-code#26018) <https://github.com/anthropics/claude-code/issues/26018#issuecomment-4127801943> OK it is, and you can create you own harness. Coming from a frequent rage poster, this is manageable by a well made harness, optimizing MCPs, controlling context bloat, and just restarting the session after it creates a comprehensive hand-off. Have it audit, have another agent audit it against the conversation and move on. You can only expect so much from this awesome tool. After doing those things and restarting my sessions more frequently, 0 instances of this issue. Not to say it does not still exist but it is entirely manageable while they sort it out. I would still take this over gemini's hack and slash harness. — Reply to this email directly, view it on GitHub <https://github.com/anthropics/claude-code/issues/26018?email_source=notifications&email_token=AJXYKRUOOEXTRSZJZW7E5T34SP7JTA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJSG44DAMJZGQZ2M4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-4127801943>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AJXYKRUPGR622QORI32XAQT4SP7JTAVCNFSM6AAAAACVHQLZASVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DCMRXHAYDCOJUGM> . You are receiving this because you commented.Message ID: @.***>
asherzyz · 3 months ago

I was able to skip this problem using /compact.

pablosanzo · 3 months ago

You can get around this issue by:

  1. /rewind to the latest message before the error
  2. /compact instead of whatever you were asking Claude
  3. Now ask again that thing from Claude

The slow response from @anthropics should make you pause, though, and consider open source alternatives:

(Not to mention open weights models)

iamk3nnyt · 3 months ago

Their models has been degraded. Opus 4.6 among others have been degraded due to financial benefits from the company. I will switch to using a fake credit card. I urge you to do the same

pablosanzo · 3 months ago

Claude Code full code has been leaked, so now you can fix this on your own if you'd like (just ask Claude to do it)

Natshah · 3 months ago

Facing the same issue when working with PDF and big files as a source.