[BUG] Stuck in failure loop due to invalid image file

Resolved 💬 3 comments Opened Dec 7, 2025 by mgosha Closed Dec 11, 2025

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

  • When Read tool fails on a corrupt image file, the image data is still added to conversation context
  • Subsequent API calls fail with "Could not process image"
  • This blocks all further interaction until the session file is manually edited
  • The bug compounds when Claude retries, adding multiple corrupt images

What Should Happen?

Claud should detect that the file is invalid and continue rather repeated give me the same response for every prompt.

Error Messages/Logs

Steps to Reproduce

  • When Read tool fails on a corrupt image file, the image data is still added to conversation context
  • Subsequent API calls fail with "Could not process image"
  • This blocks all further interaction until the session file is manually edited
  • The bug compounds when Claude retries, adding multiple corrupt images

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.0.62

Platform

Anthropic API

Operating System

Other Linux

Terminal/Shell

iTerm2

Additional Information

Bug #1: Corrupt Images Block Forever

  • When Read fails on a corrupt image, the corrupt data is still added to context
  • All subsequent requests fail with "Could not process image"
  • No recovery mechanism - requires manual session editing

Bug #2: Oversized Images Block Forever

  • Claude reads valid JPEGs that exceed API limits (>2000px when multiple images present)
  • All subsequent requests fail with "exceed max allowed size"
  • No recovery mechanism - requires manual session editing

The Root Problem

Claude Code doesn't validate or resize images before adding them to context. It should:

  1. Validate images before calling Read()
  2. Check dimensions and reject/resize images >2000px when multiple images are in conversation
  3. Handle Read errors gracefully without poisoning the context
  4. Provide user feedback instead of silent blocking

View original on GitHub ↗

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