[BUG] API Error: 400

Resolved 💬 3 comments Opened Nov 19, 2025 by gato-72 Closed Nov 19, 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?

when dropping a .png for review CC gets frozen, and the response is

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.27.content.4.image.source.base64.data: Image does not match the
provided media type image/jpeg"},"request_id":"req_011CVGXpJhef6DFtLuBbCxzZ"}

What Should Happen?

as always just review the screenshot and reply whatever it sees and report

Error Messages/Logs

⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.27.content.4.image.source.base64.data: Image does not match the 
    provided media type image/jpeg"},"request_id":"req_011CVGXpJhef6DFtLuBbCxzZ"}

Steps to Reproduce

## Bug Description
Claude Code crashes with API Error 400 when user drops an image into the chat. The error message indicates a mismatch between the actual image format and the
media type being sent to the API.

## Steps to Reproduce

  1. Have an active conversation with Claude Code
  2. Drop an image file (screenshot/PNG) into the chat interface
  3. Claude Code freezes and displays this error:

⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.27.content.4.image.source.base64.data: Image does not match the
provided media type image/jpeg"},"request_id":"req_011CVGXpJhef6DFtLuBbCxzZ"}

## Expected Behavior
Claude Code should:

  • Correctly detect the image format (PNG, JPEG, etc.)
  • Send the proper media type header to match the actual image format
  • Process the image without errors

## Actual Behavior

  • Claude Code incorrectly labels the image as image/jpeg when it's actually a PNG (or other format)
  • API rejects the request with 400 error
  • Chat session freezes and becomes unresponsive
  • User cannot continue the conversation

## Root Cause (suspected)
Claude Code is not properly detecting image MIME types before encoding and sending to the API. It appears to default to image/jpeg regardless of actual
file format.

## Impact

  • Severity: High - Completely blocks the chat session
  • User loses context and must restart conversation
  • Makes image-based debugging/screenshot sharing unreliable

## Additional Notes

  • This error never happens with ChatGPT or other AI assistants
  • The bug occurs specifically when dropping images, not when referencing image file paths
  • Error shows Claude Code sent wrong media type header to Anthropic API

## Environment

  • OS: macOS
  • Date: November 18, 2025
  • Error ID: req_011CVGXpJhef6DFtLuBbCxzZ

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

Claude Code v2.0.45 Sonnet 4.5 ·

Platform

Other

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

<img width="624" height="807" alt="Image" src="https://github.com/user-attachments/assets/fb2f07fe-0820-4462-9b57-1c5233c9b46d" />\
\
that was the string of the image

View original on GitHub ↗

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