Repository navigation
Image Processing Failure: API Rejects Unrelated Context Image #4083
Description
Activity
- addedbugSomething isn't workingSomething isn't workinghas reproHas detailed reproduction stepsHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOSIssue specifically occurs on macOS
on Jul 21, 2025 - marked Attempting to read false image data creates an error loop [BUG] #6175 as a duplicate of this issue
on 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
Reacted by João Vitor and soychpapalusI was getting this repeatedly even after restarting Claude Code. Switching projects fixed it.
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.
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.
- addedautocloseIssue will be closed automaticallyIssue will be closed automatically
on Dec 8, 2025 I am still seing this issue
- removedautocloseIssue will be closed automaticallyIssue will be closed automatically
on Dec 11, 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
Still facing
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process image"},"request_id":"req_011CXNRvrosdNtuqWruf63CK"}Same! It's crazy, and I think it might be related to Claude trying to read either
.webpimages or broken imagesstill facing
Is there at least a workaround to this?
@SABRYX you can add a rule to CLAUDE.md that says that before reading an image it should validate it first
Reacted by Mohamed Abed, Hi Human and melonI 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:
API Error: 400 {"type":"error","error":{"type":"i nvalid_request_error","message":"Could not process image"},"request_id":"req_011CYW8FkoQBsT8 MAC5GZZ1C"} API Error: 400 {"type":"error","error":{"type":"i nvalid_request_error","message":"Could not process image"},"request_id":"req_011CYW7xZzJBwvG V3y8LMdVc"}Same Issue on my end too with Claude Code
❯ oka stop, whats wrong? ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process image"},"request_id":"req_011CYpAJroCR9LiTBCNacY59"} ❯ stop. stop trying to pull requeets, whats wrong, why cant i speak to you anymore ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process image"},"request_id":"req_011CYpALhsjB18Gow3yH2aYq"} ❯ s ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process image"},"request_id":"req_011CYpAM67gqMwqXtwtUdgTF"} ❯ . ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process image"},"request_id":"req_011CYpAMNUSj1YcaZFFLhbAH"} ❯ can you stop? just dont read the image, do something else. i think that image is buggy, just skip it ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process image"},"request_id":"req_011CYpASKJqEQktmmiC93Lgm"} ❯ stop. can you jsut say hello to me? ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process image"},"request_id":"req_011CYpATUYyxb4aL1AZAiqza"}Fails whether I paste form clipboard or source a file:
❯ Look at the DOM and the HTML. The ECS div is hidden. ⎿ [Image #1] ⎿ API Error: 400 Could not process image ❯ @/tmp/pasted_file.png ⎿ Read ../../../../../../tmp/pasted_file.png (83.5KB) ⎿ API Error: 400 Could not process imageThe image I'm pasting is a valid PNG:
[2026-03-10 22:08:30]» pngfix /tmp/pasted_file.png IDAT OK default 15 15 85273 1627110 /tmp/pasted_file.pngSame issue. Just tried to have Claude convert downloaded jpg to webP to add to WordPress pattern and got this multiple times
I see ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process image"},"request_id":"req_011CZ4afzQH6PLHvwJTEMv89"} . So perhaps another way is neeeded ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process image"},"request_id":"req_011CZ4ahJaSj83H2Pq5V8AE6"} ❯ I see ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process image"},"request_id":"req_011CZ4afzQH6PLHvwJTEMv89"} . So perhaps another way is needed? ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process image"},"request_id":"req_011CZ4apD22SrezTsjpwPja1"} ❯ image added to so convert and add it ⎿ [Image #2] ⎿ [Image #3] ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process image"},"request_id":"req_011CZ4awcVbhvE3KveqrxuEm"} ❯ this image then? ⎿ [Image #4] ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process image"},"request_id":"req_011CZ4b2arWfYgCFkBFJjeBt"} ❯ continue ⎿ Loaded demo/web/app/themes/elayne/CLAUDE.md ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process image"},"request_id":"req_011CZ5k1rWcpVusM2f3yavyS"} ✻ Brewed for 30sTried downloading CC0 image myself and feeding it to Claude Code but that did not work either.
It seems that there is another issue which is concerned with corrupt images that produce the same (or similar) behavior: #24387
I screenshot-ted the image and replaced it, it worked.
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
Reacted by Jasper FrumauReacted by zernieI followed @zernie 's rec to update CLAUDE.md
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
Recovery: press Esc Esc to open Rewind menu and restore conversation before the error, or /clear (loses all context).
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
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.