[BUG] reading a broken image corrupts the session
Resolved 💬 3 comments Opened Dec 21, 2025 by jschachter Closed Dec 25, 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?
Reading a file with mismatched extension/content permanently corrupts the session
When Claude Code reads a file that has a .png extension but contains non-PNG data (e.g., SVG content), the Read tool fails with an API error. However, the corrupted "image" data remains in the conversation context, causing all subsequent API calls to fail with the same error - even messages completely unrelated to the file.
Steps to reproduce:
- Have a file with .png extension that actually contains SVG/text data
- Ask Claude to read/look at the file
- Observe the API error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process image"}}
- Send any follow-up message
- Same error occurs - session is now permanently broken
What Should Happen?
It should just gripe about being a badly formed image, probably.
Error Messages/Logs
> let's test. please take a look at output.png
● Read(output.png)
⎿ Read image (118.3KB)
⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process image"},"request_id":"req_011CWLTzUBhfuyAdvFkkH6wT"}
> ok are you ok?
⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process image"},"request_id":"req_011CWLU1BwBQ5iYYJh7CUXsx"}
Steps to Reproduce
- Create a svg file and name it output.png
- Ask claude to look at it.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
Version: 2.0.75
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗