Image Processing Failure: API Rejects Unrelated Context Image

Open 💬 20 comments Opened Jul 21, 2025 by JVmano

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.

View original on GitHub ↗

20 Comments

t-e-lawrence · 11 months ago

same issue here, my specific case #6175 attempted to read a .jpg that actually contained html data causing this exact same loop

brandon-thomson · 10 months ago

I was getting this repeatedly even after restarting Claude Code. Switching projects fixed it.

jaredthirsk · 10 months ago

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[bot] · 7 months ago

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 · 7 months ago

I am still seing this issue

trinanda · 7 months ago

still facing this issue:
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process image"},"request_id":"req_011CWDq6UFkcTA3XCKdbLND9"}

JayFromEpic · 6 months ago

Can confirm, this is very much so still an issue:
API Error: 400
{"type":"error","error":{"type":"invalid_request_error","message":"Could not process
image"},"request_id":"req_011CWdKWQhhsrD3Vz9roBzu9"}

AndreySoloviev · 5 months ago

Still facing

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process
     image"},"request_id":"req_011CXNRvrosdNtuqWruf63CK"}
zernie · 5 months ago

Same! It's crazy, and I think it might be related to Claude trying to read either .webp images or broken images

timothywangdev · 5 months ago

still facing

SABRYX · 5 months ago

Is there at least a workaround to this?

zernie · 5 months ago

@SABRYX you can add a rule to CLAUDE.md that says that before reading an image it should validate it first

theoBLT · 4 months ago

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:

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"}
Ice-Citron · 4 months ago

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"}
socketbox · 4 months ago

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 image

The 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.png
jasperf · 4 months ago

Same 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 30s

Tried downloading CC0 image myself and feeding it to Claude Code but that did not work either.

socketbox · 3 months ago

It seems that there is another issue which is concerned with corrupt images that produce the same (or similar) behavior: https://github.com/anthropics/claude-code/issues/24387

agamm · 3 months ago

I screenshot-ted the image and replaced it, it worked.

justi · 3 months ago

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 haiku to 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 · 3 months ago
I 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).