[BUG] API 413 error loop
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?
Summary: Session becomes permanently unrecoverable after 413 "Request exceeds maximum size" error when reading multiple PDFs
Description:
When reading multiple PDF files sequentially, hitting the 413 error does not gracefully fail — instead, the entire session becomes bricked. Every subsequent API call (including basic commands, /compact, and even /save session) returns the same 413 error. There is no way to recover the session; the only option is to kill the terminal and start fresh, losing all session context and work.
Expected behavior:
The 413 error should fail gracefully for the specific file that triggered it
The session should remain usable afterward
Commands like /compact or /clear should be able to recover the session by dropping the oversized content
Actual behavior:
After the 413 error, the oversized content appears to remain in the context
All subsequent API calls fail with the same 413 error
No recovery is possible from within the session
Session must be killed externally, losing all context
Reproduction:
Read multiple large PDFs in sequence (in this case, 4 PDFs totaling ~30MB before the error triggered). See transcript below.
Environment: Claude Code via terminal (version not captured in transcript)
Transcript below in log space:
What Should Happen?
The 413 error should fail gracefully for the specific file that triggered it
The session should remain usable afterward
Commands like /compact or /clear should be able to recover the session by dropping the oversized content
Error Messages/Logs
I can read the PDFs directly - there are 18 of them covering snow hydrology, CLM, sublimation, albedo, etc.
For the Google Sheet, the easiest options are:
1. Download as CSV (recommended): File → Download → Comma Separated Values (.csv) and save it to that same folder
2. Download as Excel: File → Download → Microsoft Excel (.xlsx) - I can read this too
Just let me know where you save it and I'll read everything together.
Want me to start reading the PDFs now while you download the spreadsheet?
❯ yes start on the PDFs
⏺ Read(~/Princeton Dropbox/Reed Maxwell/ucrb_temperature_ms/PackedSnow/gmd-15-5045-2022.pdf)
⎿ Read PDF (13.7MB)
⏺ Read(~/Princeton Dropbox/Reed Maxwell/ucrb_temperature_ms/PackedSnow/tc-15-743-2021.pdf)
⎿ Read PDF (12MB)
⏺ Read(~/Princeton Dropbox/Reed Maxwell/ucrb_temperature_ms/PackedSnow/hess-18-5061-2014.pdf)
⎿ Read PDF (601.5KB)
⏺ Read(~/Princeton Dropbox/Reed Maxwell/ucrb_temperature_ms/PackedSnow/feart-06-00197.pdf)
⎿ Read PDF (3.2MB)
⎿ API Error: 413 {"error":{"type":"request_too_large","message":"Request exceeds the maximum size"}}
❯ are you still reading? the spreadsheet is at SNOW_calcs.xlsx it's notes and equations that wouldn't translate very well to CSV, make sure to look at
both tabs. also you can skip the large PDF
⎿ API Error: 413 {"error":{"type":"request_too_large","message":"Request exceeds the maximum size"}}
❯ can you increase the max size of PDF files you can read? or can I do that for you
⎿ API Error: 413 {"error":{"type":"request_too_large","message":"Request exceeds the maximum size"}}
❯ okay, change of plans, read both tabs and all cells of SNOW_calcs.xlsx and summarize, look for additional information regarding
parameterizations here
⎿ API Error: 413 {"error":{"type":"request_too_large","message":"Request exceeds the maximum size"}}
❯ save session
⎿ API Error: 413 {"error":{"type":"request_too_large","message":"Request exceeds the maximum size"}}
Steps to Reproduce
Read multiple large PDFs in sequence (in this case, 4 PDFs totaling ~30MB before the error triggered). See transcript below.
Claude Model
Opus
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.4 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗