[BUG] Conversation breaks(throws 400) after image encoding error

Resolved 💬 2 comments Opened Sep 3, 2025 by muddi900 Closed Sep 3, 2025

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 1.0.94
  • Operating System: macos 15.5
  • Terminal: VSCode terminal

Bug Description

I am building an app that the saves an image as base64 in a database. I noticed that the mimitype on the string was incorrect. I asked it to try a fix and it broke the input instead. Now that broken image is part of context every input in the session gets this response.

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.1.content.0.image.source
    .base64.media_type: Input should be 'image/jpeg', 'image/png', 'image/gif' or 
    'image/webp'"},"request_id":"req_011CSkvGh2ZBPjejMTkGWm2q"}

I tried /compact and it throws the same error:

Error: Error during compaction: Error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","mess
    age":"messages.0.content.1.image.source.base64.media_type: Input should be 'image/jpeg', 'image/png', 'image/gif' 
    or 'image/webp'"},"request_id":"req_011CSkvpw6XgWzgQrQpqNEmT"}

Steps to Reproduce

  1. Take a broken image file and make the text part of your context.
  2. send the prompt.

Expected Behavior

Working as normal

Actual Behavior

Throws 400 error for each prompt

View original on GitHub ↗

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