Repository navigation
Image Processing Failure: API Rejects Unrelated Context Image #4083
Copy link
Copy link
Open
Labels
area:apiarea:corearea:toolsbugSomething isn't workingSomething isn't workinghas reproHas detailed reproduction stepsHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOSIssue specifically occurs on macOS
Description
Bug Description
The context is returning on all type of prompts the error ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process image"}} because has a image in the context, even when the image isn't related to the prompt task, it returns this error in a loop, making the thread stuck.
Environment Info
- Platform: darwin
- Terminal: ghostty
- Version: 1.0.56
- Feedback ID: b67410b3-abad-48bf-9621-6df3c289bca8
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 A7 (file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:797:5848)\n at file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:709:48013\n at Q (file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:609:14408)\n at fY (file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:709:45724)\n at QK (file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:709:44590)\n at SB (file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:709:50639)","timestamp":"2025-07-21T14:19:27.942Z"},{"error":"Error: ENOENT: no such file or directory, open '/proc/version'\n at Module.readFileSync (node:fs:441:20)\n at Object.readFileSync (file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:615:7077)\n at file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:615:8638\n at Q (file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:609:14408)\n at kT4 (file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:709:62815)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-07-21T14:19:28.459Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"Could not process image\"}}\n at V4.generate (file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1249:6428)\n at dM.makeStatusError (file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1266:2101)\n at dM.makeRequest (file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1266:5315)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async w81.showErrors (file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2670:14158)\n at async w81 (file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2210:1704)\n at async mqB (file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2670:14009)\n at async file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2670:9066\n at async JKA (file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2670:1626)\n at async ra (file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2670:9036)","timestamp":"2025-07-21T14:19:33.032Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"Could not process image\"}}\n at V4.generate (file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1249:6428)\n at dM.makeStatusError (file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1266:2101)\n at dM.makeRequest (file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1266:5315)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async w81.showErrors (file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2670:14158)\n at async w81 (file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2210:1704)\n at async mqB (file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2670:14009)\n at async file:///Users/sephrot/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2670:Note: Error logs were truncated.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:apiarea:corearea:toolsbugSomething isn't workingSomething isn't workinghas reproHas detailed reproduction stepsHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOSIssue specifically occurs on macOS
Activity
t-e-lawrence commentedon Aug 20, 2025
same issue here, my specific case #6175 attempted to read a .jpg that actually contained html data causing this exact same loop
brandon-thomson commentedon Sep 6, 2025
I was getting this repeatedly even after restarting Claude Code. Switching projects fixed it.
jaredthirsk commentedon Sep 11, 2025
I just ran into something related to this with a 179KB png that I wanted Claude Code to analyze. I started a new session and it proceeded with analyzing the image.
github-actions commentedon Dec 8, 2025
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.
Zikoat commentedon Dec 11, 2025
I am still seing this issue
trinanda commentedon Dec 18, 2025
still facing this issue:
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process image"},"request_id":"req_011CWDq6UFkcTA3XCKdbLND9"}1 remaining item
AndreySoloviev commentedon Jan 22, 2026
Still facing
zernie commentedon Jan 25, 2026
Same! It's crazy, and I think it might be related to Claude trying to read either
.webpimages or broken imagestimothywangdev commentedon Jan 31, 2026
still facing
SABRYX commentedon Feb 16, 2026
Is there at least a workaround to this?
zernie commentedon Feb 16, 2026
@SABRYX you can add a rule to CLAUDE.md that says that before reading an image it should validate it first
theoBLT commentedon Feb 26, 2026
I have the same issue. Session becomes fully corrupted with repeated errors [0]. I followed @zernie 's rec to update CLAUDE.md, and the second time around in another session with the exact same prompt, I did not have the issue. Not sure if causal, but that unlocked me, thanks!
[0] Examples:
Ice-Citron commentedon Mar 7, 2026
Same Issue on my end too with Claude Code
socketbox commentedon Mar 11, 2026
Fails whether I paste form clipboard or source a file:
The image I'm pasting is a valid PNG:
jasperf commentedon Mar 16, 2026
Same issue. Just tried to have Claude convert downloaded jpg to webP to add to WordPress pattern and got this multiple times
Tried downloading CC0 image myself and feeding it to Claude Code but that did not work either.
socketbox commentedon Mar 25, 2026
It seems that there is another issue which is concerned with corrupt images that produce the same (or similar) behavior: #24387
agamm commentedon Mar 27, 2026
I screenshot-ted the image and replaced it, it worked.
justi commentedon Mar 27, 2026
Update: The workaround hook now uses a subprocess proxy (v9) — instead of passing converted images to the context (which still accumulates), it spawns a fresh
claude --model haikuto analyze each image and returns text only. Zero image data in context, unlimited reads per session.Features: auto-context from session transcript, PostToolUse cleanup, prompt injection resistant.
Gist: https://gist.github.com/justi/8265b84e70e8204a8e01dc9f99b8f1d0
Stress-tested: 15 images in one session, zero errors.
cc @JVmano @AndreySoloviev @Ice-Citron @JayFromEpic @SABRYX @Zikoat @agamm @brandon-thomson @jaredthirsk @jasperf @socketbox @t-e-lawrence @theoBLT @timothywangdev @trinanda @zernie
soychpapalus commentedon Apr 10, 2026
What recommendation? Is there a way to recover from this or is the session doomed? I keep having this issue...
edit: https://gist.github.com/justi/8265b84e70e8204a8e01dc9f99b8f1d0