[Bug] Anthropic API Error: Image dimensions exceed max allowed size (8000 pixels)
Status Closed — not planned
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 13 comments · opened Nov 25, 2025 · closed Mar 12, 2026
Bug Description
⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.5.content.1.image.source.base64.data:
At least one of the image dimensions exceed max allowed size: 8000 pixels"},"request_id":"req_011CVUZozoQZCyAGGCbwhcEy"} bug
This makes the entire chat unusable.
Environment Info
- Platform: darwin
- Terminal: cursor
- Version: 2.0.53
- Feedback ID: 76e7fe2d-7b15-4675-aaae-d83103685fe0
Errors
[{"error":"Error: Request was aborted.\n at jo._createMessage (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:463:3151)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-11-25T11:29:32.581Z"},{"error":"Error: Request was aborted.\n at XT.makeRequest (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1312:3939)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-11-25T11:30:15.440Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.5.content.1.image.source.base64.data: At least one of the image dimensions exceed max allowed size: 8000 pixels\"},\"request_id\":\"req_011CVUZkZLdRX3aPyDR9JZ8F\"}\n at I9.generate (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:459:9423)\n at XT.makeStatusError (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1312:2195)\n at XT.makeRequest (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1312:5419)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async l41.model (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3934:14345)\n at async l41 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2081:1872)\n at async tX9 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3934:14497)\n at async file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3934:7845\n at async Nr1 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1464:1971)\n at async MIA (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3934:7815)","timestamp":"2025-11-25T11:56:21.658Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.5.content.1.image.source.base64.data: At least one of the image dimensions exceed max allowed size: 8000 pixels\"},\"request_id\":\"req_011CVUZnnQFGBegd3NjmeqJQ\"}\n at I9.generate (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:459:9423)\n at XT.makeStatusError (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1312:2195)\n at XT.makeRequest (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1312:5419)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async l41.model (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3934:14345)\n at async l41 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2081:1872)\n at async tX9 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3934:14497)\n at async file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3934:7845\n at async Nr1 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1464:1971)\n at async MIA (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3934:7815)","timestamp":"2025-11-25T11:56:52.191Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.5.content.1.image.source.base64.data: At least one of the image dimensions exceed max allowed size: 8000 pixels\"},\"request_id\":\"req_011CVUZozoQZCyAGGCbwhcEy\"}\n at I9.generate (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:459:9423)\n at XT.makeStatusError (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1312:2195)\n at XT.makeRequest (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1312:5419)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async l41.model (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3934:14345)\n at async l41 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2081:1872)\n at async tX9 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3934:14497)\n at async file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3934:7845\n at async Nr1 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1464:1971)\n at async MIA (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claud
Note: Error logs were truncated.
13 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Image Dimension Error - Conversation Killer
The API is rejecting your image because it's >8000 pixels in at least one dimension. Claude Code should've resized it before sending.
Immediate Fix
Clear the problematic message from history:
Root Cause
Claude Code took a screenshot or you attached an image that's too large:
The bug: Claude Code should automatically resize images BEFORE sending to API, but it's not.
Verify Image Size
Check the actual image dimensions:
If you see dimensions >8000, that's your culprit.
Workaround: Resize Before Sharing
If you need to share large screenshots:
Then share the resized version.
Proper Fix (Needs Anthropic)
Claude Code should:
Feature Request
Add config for max image dimensions:
Recovery
If your conversation is stuck:
Then restart Claude Code - it'll load the truncated history without the bad image.
I also ran into this and since I'm working with images on a project, had Claude add the following hook to check image dimensions as a
PreToolUsehook. This doesn't fix the problem but it at least avoids corrupting the chat (which is highly disruptive to my workflow.)---
.claude/settings.local.json- Hook configuration:---
.claude/hooks/check-image-size.sh- Hook script that:Hey @panozzaj! 👋
This is a really clever workaround! The PreToolUse hook approach is exactly the kind of defensive programming that saves workflows from breaking at the worst possible moment.
I love that you went conservative with the 2000px limit instead of cutting it close to 8000px - smart thinking about multi-image requests. The fallback chain (ImageMagick → sips → allow) also shows solid defensive design.
One small suggestion: You might want to add a note in the hook's header comment about why 2000px specifically (the multi-image scenario), since it's not immediately obvious and could save future debugging time.
Thanks for sharing this with the community - definitely going to help people working with images until Anthropic implements automatic resizing in the CLI! 🙌
---
*Side note for anyone implementing this: make sure to
chmod +x .claude/hooks/check-image-size.shafter creating itecho ___BEGIN___COMMAND_OUTPUT_MARKER___ ; PS1= ; PS2= ; unset HISTFILE ; EC=0 ; echo ___BEGIN___COMMAND_DONE_MARKER___0 ; }I had gotten this error:
Looks like maybe there's a
many-imagesrequest that has different limits.Hey everyone 👋
After repeatedly facing this issue, I decided to build claude-code-image-sanitizer using some of the
feedback and insights shared across related issues.
What it does:
Would love any feedback/contributions!
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
omfg it's still opened
in 2026 claude code still can't work with images and not to crash the whole pipeline
Had not previously had this issue, but at some point on a bug hunting spree Claude started grabbing screen caps of 2160p images and this loop occurred for me as well however I was prompted to double press esc which allowed reversion to (much) earlier point, bugged point, or to clear. I think it's an important distinction if I'm not an outlier.
hitting this right now
https://github.com/anthropics/claude-code/issues/12351#issuecomment-3591811948. This worked.
Running
/insightsin Claude Code gave me this to put in my global~/.claude/CLAUDE.mdfile:This worked for me.
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.