Image pasting error: "Image does not match the provided media type image/png"
Sorry if this issue sucks it's my first time writing one (err, having claude write one...), feel free to let me know what else is needed to triage it.
Description
Sometimes after pasting an image into Claude Code and sending a message, subsequent messages consistently fail with an API error related to image media type validation. I verified the image I tried to paste is a PNG.
Error Message
Error: Error during compaction: Error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.12.content.0.image.source.base64.data: Image does not match the provided media type image/png"}}
<img width="890" height="1832" alt="Image" src="https://github.com/user-attachments/assets/a8a738d7-60a2-406a-93ec-e1fc05a67d15" />
Steps to Reproduce
- Paste an image into Claude Code
- Send the message with the image
- Attempt to send any subsequent message
- Error occurs repeatedly for all new messages
Environment
- OS: macOS 15.5
- Claude Code Model: claude-Opus-4-20250514
Expected Behavior
Images should be processed correctly without affecting subsequent message sending.
Actual Behavior
After pasting an image, all subsequent messages fail with the media type validation error, making Claude Code unusable until potentially restarted.
Impact
This is a blocking issue that prevents continued use of Claude Code including compacting the conversation after pasting an image. Will allow clearing.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗