Read tool: Git LFS pointer file mistaken for image causes unrecoverable conversation loop
Description
When the Read tool is used on a file that has an image extension (e.g., .png) but is actually a Git LFS pointer file (plain text), the API returns a 400 error:
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process image"}}
This is expected for a single attempt — the file isn't a valid image. The critical issue is what happens after: the malformed "image" remains in the conversation context, and every subsequent user message triggers the same error repeatedly, making the conversation unusable. The user cannot recover without starting a new conversation.
Steps to Reproduce
- Download a Git LFS pointer file that has an image extension:
``bash``
curl -sL "https://raw.githubusercontent.com/chickensoft-games/Chicken/main/icon.png" -o /tmp/test.png
- The file is actually a 131-byte LFS pointer:
````
version https://git-lfs.github.com/spec/v1
oid sha256:796e62f8e6d70b18cbe2fcda3debc29ffce327eaa12bbdc3650fef6d6189bba4
size 914901
- Use the Read tool on
/tmp/test.png - API returns "Could not process image"
- Every subsequent message in the conversation hits the same error — the conversation is stuck in a crash loop
Expected Behavior
- The Read tool should detect that the file is not actually an image (e.g., check magic bytes, not just extension) before sending it to the API as an image
- OR: if the API rejects an image, the failed image should be removed from the conversation context so subsequent turns are not poisoned
- OR: at minimum, the conversation should gracefully recover rather than entering an infinite error loop
Environment
- Claude Code version: 2.1.72
- OS: macOS (Darwin 23.6.0)
- Model: claude-opus-4-6
Impact
Medium — requires the user to abandon the conversation entirely. In the observed case, the user had to send multiple messages before understanding the conversation was unrecoverable.
4 Comments
Reproduction
Reproduced in a fresh session. Screenshot showing:
API Error: 400 "Could not process image"<img width="994" height="410" alt="Image" src="https://github.com/user-attachments/assets/1fff4468-3486-48fd-9b77-6f97ee82bd64" />
The conversation becomes permanently unusable after step 1.
Found 2 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Closing as duplicate of #24387, which is the comprehensive report for this bug. Added the Git LFS pointer scenario there as an additional trigger.
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.