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

Resolved 💬 4 comments Opened Mar 10, 2026 by mrtysn 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 ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗