Read tool: Git LFS pointer file mistaken for image causes unrecoverable conversation loop

Status Fixed / completed
Reported on v2.1.72
Maintainer reply None cached
Activity 4 comments · opened Mar 10, 2026 · closed Mar 12, 2026

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

  1. 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
``

  1. The file is actually a 131-byte LFS pointer:

``
version https://git-lfs.github.com/spec/v1
oid sha256:796e62f8e6d70b18cbe2fcda3debc29ffce327eaa12bbdc3650fef6d6189bba4
size 914901
``

  1. Use the Read tool on /tmp/test.png
  2. API returns "Could not process image"
  3. 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.

View original on GitHub ↗

4 Comments

mrtysn · 7 months ago

Reproduction

Reproduced in a fresh session. Screenshot showing:

  1. Read tool on the LFS pointer file → API Error: 400 "Could not process image"
  2. User sends "continue" → same error repeats without any tool call, confirming the corrupted image is stuck in conversation context

<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.

github-actions[bot] · 7 months ago

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/19031
  2. https://github.com/anthropics/claude-code/issues/24387

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

mrtysn · 7 months ago

Closing as duplicate of #24387, which is the comprehensive report for this bug. Added the Git LFS pointer scenario there as an additional trigger.

github-actions[bot] · 6 months ago

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.