Skip to content

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

Closed as duplicate

Description

@mgosha

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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

Activity

  1. added
    bug
    on Dec 7, 2025
  2. added
    has repro
    platform:linux
    on Dec 7, 2025
  3. github-actions commented on Dec 7, 2025

    @github-actions

    Found 3 possible duplicate issues:

    1. [Bug] Image reading failure causes unrecoverable conversation state #11887
    2. [BUG] Cancelling image Read operation with ESC leaves conversation in broken state #9509
    3. [BUG] Session becomes completely unrecoverable due to thinking block API error #12743

    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

  4. added
    duplicate
    and removed
    bug
    has repro
    platform:linux
    on Dec 11, 2025
  5. github-actions commented on Dec 11, 2025

    @github-actions

    This issue has been automatically closed as a duplicate of #11887.

    If this is incorrect, please re-open this issue or create a new one.

    🤖 Generated with Claude Code

  6. github-actions commented on Dec 18, 2025

    @github-actions

    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.

  7. locked as resolved and limited conversation to collaborators on Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions