Repository navigation
Done
Labels
area:apibugSomething isn't workinghas reproHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOS
Description
Bug Description
after submitting an image too large, the context is polluted and any other request returns the error API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.17.content.1.image.source.base64.data: At least one of the image dimensions exceed max allowed size for many-image requests: 2000 pixels"}}
Environment Info
- Platform: darwin
- Terminal: cursor
- Version: 1.0.41
- Feedback ID: 635919c9-d04d-4562-9842-2a0a15d8e011
Errors
[{"error":"Error: Command failed: security find-generic-password -a $USER -w -s \"Claude Code\"\nsecurity: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.\n\n at genericNodeError (node:internal/errors:983:15)\n at wrappedFn (node:internal/errors:537:14)\n at checkExecSyncError (node:child_process:882:11)\n at execSync (node:child_process:954:15)\n at JI (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:702:3921)\n at file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:623:9038\n at Q (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:526:13327)\n at _X (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:623:8184)\n at w_ (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:623:7265)\n at U9 (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:623:11432)","timestamp":"2025-07-03T16:45:23.855Z"},{"error":"Error: Tool mcp__puppeteer__puppeteer_click not found\n at dT2 (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1958:5596)\n at ZU (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:65:19802)\n at UP (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:67:42556)\n at wP (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:67:38105)\n at o$ (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:67:38033)\n at MU (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:67:37887)\n at EJ (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:67:34977)\n at f5 (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:65:4822)\n at DB (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:67:32233)\n at A.Q.updateContainer (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:71:1835)","timestamp":"2025-07-03T16:45:27.222Z"},{"error":"Error: Tool mcp__puppeteer__puppeteer_click not found\n at dT2 (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1958:5596)\n at ZU (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:65:19802)\n at UP (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:67:42556)\n at wP (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:67:38105)\n at o$ (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:67:38033)\n at MU (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:67:37887)\n at EJ (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:67:34977)\n at f5 (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:65:4822)\n at DB (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:67:32233)\n at A.Q.updateContainer (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:71:1835)","timestamp":"2025-07-03T16:45:27.236Z"},{"error":"Error: Tool mcp__puppeteer__puppeteer_screenshot not found\n at dT2 (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1958:5596)\n at ZU (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:65:19802)\n at UP (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:67:42556)\n at wP (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:67:38105)\n at o$ (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:67:38033)\n at MU (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:67:37887)\n at EJ (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:67:34977)\n at f5 (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:65:4822)\n at DB (file:///Users/alessandro/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:67:32233)\n at A.Q.updateContainer (file:///UsersNote: Error logs were truncated.
Reacted by Liza Daly, Xiangyi Li, Arthur, Tinker, Sebadst, Michael Berndt, Jialiang Chen, Pierre Le Fevre, Andrew Doering, rishabh-lohum and 53 more
Metadata
Metadata
Assignees
Labels
area:apibugSomething isn't workinghas reproHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOS
Activity
baryon commentedon Oct 3, 2025
I didn’t upload any images and still encountered this issue—I only asked CC to modify the copy on the webpage and didn’t upload any images to him. After this error appeared, even the /compact command started returning the same error.
gthb commentedon Oct 3, 2025
Found my session afflicted with this same thing soon (within a day) after I started working with the chrome-devtools MCP server. That was going great until the session was entirely incapacitated by this error. And yep,
/compactis failing too in this session — presumably because it's trying to read that same poisoned item in the context. I'll hazard a guess that a screenshot of the remote-controlled Chrome window (or of a canvas that I have in there in a scrollable container) landed in the context despite violating some size-limit invariant, and then there's no coming back from that.saynth-ai commentedon Oct 12, 2025
Error: Error during compaction: Error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.380.content.0.image.source.base64.data: At least one of
the image dimensions exceed max allowed size: 8000 pixels"},"request_id":"req_011CU35RmzHC6WGfCL6kKbKB"}
lukasmalkmus commentedon Oct 23, 2025
Same here! Would be nice to have a command to remove the bad message from the context to compact or instruct otherwise.
JimSander-uniphore commentedon Oct 25, 2025
My Experience: 12+ Hours of Work Lost
I encountered this exact issue and lost over 12 hours of productive working history with Claude Code. The session became completely unrecoverable after an image >8000 pixels was added to the context.
Impact:
Critical Need: This needs a recovery mechanism urgently. Suggestions:
/remove-message <index>)/compactresilient to skip/remove invalid messages instead of failing/recovercommand to sanitize corrupted contextsThis is a severe UX issue that makes the tool feel fragile when working with visual content, especially when using MCP servers that generate screenshots automatically.
Meta note: This comment was drafted by Claude Code itself—the very tool that caused the problem. Even the offender agrees this needs fixing! 😅
tokmakoff commentedon Nov 13, 2025
/rewind worked for me as a recovery mechanism. I went back in the context stack however-many prompts to before the bad image from Chrome was added.
JoeEarly commentedon Nov 18, 2025
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.8.content.5.image.source.base64.data: At least one of the image dimensions exceed max allowed size: 8000 pixels"},"request_id":"req_011CVFsFR3Yo8qKa9SEVzj8F"}Has any of the dev team looked at this?
vovanrew commentedon Nov 18, 2025
Same issue to be
JoeEarly commentedon Nov 18, 2025
Well thanks for stating the obvious fella, my query was more in relation to has anyone looked at this from a dev POV with the view to fixing the ability to recover cleanly
Keeline commentedon Nov 24, 2025
This is a vexing problem and I have been burned by it many times. Yesterday I decided to take a new approach. I use Claude Code on a MacBook Pro with Sequoia. I asked it to write a Bash script to check the pixel and byte sizes to ensure they are within the limits for any image view. If it is too large, it should use ImageMagick to resize or make a copy with the appropriate specs.
I further instructed it to add it to CLAUDE.md as a priority rule to use the script every time an image might be read into the session.
I decided to add some other instructions such as a mandate of using shellcheck on Bash scripts and lint for PHP and Python before they try to run them. I was also tired of nonsensical time references to I required the session to check the current date-time before making a statement.
I can provide the code for image screening (
check_image_previe.sh). It is 154 lines with comments.In the CLAUDE.md below I have added backslashes before the triple-backticks for the formatting in github. But they may cause a problem if left in for use. With the right prompt, this would be generated by Claude Code. But it shows the intent.
Having worked with Claude Code since May 2025, this is hopefully going to rein in some of the most frequent issues I have with it. Something akin to this should be part of the core system. Creating a fatal error loop that can't be resolved without starting a new session is a serious blocker for professional use of an otherwise good system.
James D. Keeline
jhilgert commentedon Nov 24, 2025
Hey everyone,
ran into the same problem that an oversized image corrupted my conversation with Claude Code. Since it had been running for 1 hour before - without any additional message from me - I was not able to simply rewind. Thus, I looked into the directory, which stores the conversation files (simple .jsonl files) and then basically asked Claude to fix itself. Here is its solution, which worked like a charm. Hope this helps some people until a proper fix is out:
Fixing Claude Code Conversation Stuck on Oversized Image
The Problem
When Claude Code tries to read an image larger than 5MB, the API rejects it with an error like:
The base64 image data is already saved in the conversation history (
.jsonlfile), so every subsequent message keeps sending the same oversized image, causing a loop of API errors. Even new messages won't work.The Solution
1. Find the conversation file
Conversation files are stored in
~/.claude/projects/<project-path>/with UUID-style names:2. Identify the problematic lines
Find which lines are huge (contain base64 image data):
Lines with millions of bytes are the culprits (normal lines are a few KB at most).
3. Create a backup
4. Fix with this Python script
5. Restart Claude Code
The conversation should now load without errors.
Key Points
toolUseResultkey entirely (not just modify it) - otherwise Claude Code crashes trying to render it withCannot destructure property 'numLines' from nulltool_use_idto maintain conversation continuityPrevention
Before reading large images, resize them first:
15 remaining items
eeshansrivastava89 commentedon Feb 8, 2026
This is happening for me as well. Using the Claudian plugin with Obsidian. The entire conversation is now blocked after this image size issue.
sebastienkothe commentedon Feb 9, 2026
Cross-posting from ChromeDevTools/chrome-devtools-mcp#879 where this issue is being discussed from the MCP server side.
The problem: MCP servers like
chrome-devtools-mcpreturn screenshots as base64 images that can easily exceed Claude API's dimension limits (8000px for single images, 2000px when 20+ images are in context). When this happens, the Claude Code session becomes permanently corrupted — every subsequent message (including/compact) fails with the same API 400 error, making the entire session unrecoverable without manual intervention.Why this is a Claude Code issue (not just MCP): While MCP servers could add resizing as a workaround, Claude Code should handle this gracefully regardless of the image source. Specifically:
/compactresilient — skip or remove invalid messages instead of crashing on them/remove-messageor/recover) to sanitize corrupted contextsMultiple users are impacted across different MCP servers (chrome-devtools, mobile-mcp, Marionette for Flutter) and even direct image paste. The workarounds people have built (CLAUDE.md rules, external sanitizer scripts, manual .jsonl surgery) show this is a real and recurring pain point.
Ref: ChromeDevTools/chrome-devtools-mcp#879
Berfc commentedon Mar 10, 2026
I have the same issur for Claude Browser extension:
messages.5.content.14.image.source.base64.data: At least one of the image dimensions exceed max allowed size for many-image requests: 2000 pixels
OBugroviy commentedon Mar 18, 2026
Wow, this issue still hasn't been fixed!
I encountered this issue in version 2.1.78 of VS Code.
sitefinitysteve commentedon Mar 18, 2026
Nuts eh… it knows it’ll be an issue, so instead of just resizing it and continuing on, just stops and breaks, and that’s I guess just fine?
sebastienkothe commentedon Mar 18, 2026
Workaround: We ran into this too. Images > 2000px break the session.
We added this to our
CLAUDE.mdto force resize after every screenshot capture:sips -Z 1600resizes the image to fit within 1600px (longest side) while keeping aspect ratio. We chain it after everyadb pullorxcrun simctl iocall. Not a fix, but it prevents the crash reliably.yurukusa commentedon Mar 30, 2026
/tmp/gh-comment-2939.md
ryanhugh commentedon Apr 3, 2026
Same issue in the Claude Browser connector
dragonfax commentedon Apr 4, 2026
Got this today, no idea what to do. Can't get past it.
This is in Claude in Chrome.
XiaTiaoQAQ commentedon Apr 6, 2026
Same issue in Claude in Chrome.
msaidbilgehan commentedon Apr 6, 2026
I guess the issue getting worse.
Host: MacOS
Browser: Chrome Version 146.0.7680.178 (Official Build) (arm64)
Extension: Claude 1.0.66 - Claude in Chrome (Beta)
antoinekm commentedon Apr 7, 2026
For folks hitting this specifically when using the chrome-devtools-mcp server: I've opened a PR upstream that adds opt-in CLI flags to cap screenshot size before it's embedded in the MCP response.
PR: ChromeDevTools/chrome-devtools-mcp#1823 (tracked at ChromeDevTools/chrome-devtools-mcp#879)
The flags let operators cap dimensions and switch to JPEG so a single screenshot can't blow past the per-image dimension limits enforced by hosted LLM APIs (typically in the 2000-8000 px range, sometimes lower when many images are in the same request):
{ "mcpServers": { "chrome-devtools": { "command": "node", "args": [ "/absolute/path/to/chrome-devtools-mcp/build/src/bin/chrome-devtools-mcp.js", "--screenshot-format=jpeg", "--screenshot-max-width=2000", "--screenshot-max-height=2000" ] } } }(See the PR for instructions on running the branch locally before it's merged.)
Important caveats:
Posting this here because @OrKoN from the chrome-devtools-mcp team explicitly invited a cross-post in ChromeDevTools/chrome-devtools-mcp#879. Hope it helps anyone blocked in the meantime.
QuicksilverSlick commentedon Apr 13, 2026
💡 Session Recovery Workaround (No ffmpeg needed)
If your session is bricked by an oversized image, here's a clean recovery method that preserves your full context:
~/.claude/projects/(orC:\Users\<You>\.claude\projects\on Windows).jsonlfile (by modified date)/initto re-initialize project context.jsonlfile into the chat and tell Claude: "Analyze this session log and get fully caught up on where we left off."This works because the
.jsonlfiles contain the complete conversation history. Feeding it into a fresh session gives you all the context without the corrupted state (the stuck oversized image causing the 400 error loop).bpasero-ant commentedon Nov 28, 2026
This was fixed in Claude Code 2.1.126, so we're closing this issue. If you disagree, let us know here and we can re-open it. Thanks for reporting!