Bug: Image API error triggers infinite loop, rapidly exhausting session tokens
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?
I am experiencing a critical issue where an API error is triggering an infinite loop, completely exhausting my session tokens within less than 10 minutes.
Every time the system generates the error message below, the model mistakes the error text for a user prompt and attempts to process it continuously. This has resulted in massive token drainage and has locked me out of my session with a 5-hour rate-limit wait time.
Error Message:
"API Error: an image in the conversation could not be processed and was removed. Re-read the file with a different approach if you still need it."
Could you please look into why this error is getting fed back into the conversation history as a prompt, and assist in resetting my rate limit so I can resume work?
What Should Happen?
When an image processing error occurs, the system should halt execution, display the error message to the user, and wait for new manual input. The error message text should not be appended to the conversation history in a way that causes the model to mistake it for a new user prompt and enter an automated infinite loop.
Error Messages/Logs
"API Error: an image in the conversation could not be processed and was removed. Re-read the file with a different approach if you still need it."
Steps to Reproduce
- Start a standard Claude Code session.
- Upload/reference an image that triggers a processing failure (e.g., due to format or corruption).
- The API returns the error: "API Error: an image in the conversation could not be processed..."
- Observe that the model immediately reads this error as a new prompt and automatically tries to respond to it.
- This triggers the error again, creating an automated loop that consumes thousands of tokens per minute until the 5-hour rate limit is triggered.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.1.143
Claude Code Version
claude opus 4.7
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗