-
Notifications
You must be signed in to change notification settings - Fork 18.2k
[BUG] "Request too large (max 20MB)" error on small files (99KB PNG) #34751
Description
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?
After extended multi-day session with compaction, Claude Code triggers
"Request too large (max 20MB)" on operations involving small files. Observed
when writing a 160-line (~8KB) markdown file and when reading small PNG
screenshots (99KB-224KB). Files are confirmed small via ls -la. The error
appears to be a false positive from degraded context state, not actual file
size. Closing and reopening the session is the only workaround.
What Should Happen?
Claude should read and write small files without size errors regardless of
session length. If the session context has grown too large from extended
multi-day use or many file operations/screenshots, Claude should either
auto-compact proactively before hitting limits, or surface a helpful message
like "Session context is full — compacting now" instead of the misleading
"Request too large (max 20MB)" error, which implies the file itself is too
large when it isn't.
Error Messages/Logs
Request too large (max 20MB). Double press esc to go back and try with a
smaller file.Steps to Reproduce
- Keep a Claude Code session open for extended period (multiple days, with
automatic compaction occurring) - Continue working — writing files, reading files, normal operations
- Eventually any file operation (Write, Read, drag-and-drop) triggers the
error
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
No response
Claude Code Version
2.1.76
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
Bug correlates with long-running sessions (multi-day with compaction). Fresh
sessions work fine. Not file-type specific — happens with both .md and .png
files. Only workaround is closing and restarting the session.