Desktop app sends JPEG images with image/png media type causing API 400 error

Resolved 💬 3 comments Opened Mar 17, 2026 by niktu2025-cmyk Closed Mar 20, 2026

Bug Description

When attaching a JPEG image via the "+" button in Claude Code desktop app, the API returns a 400 error:

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.2.content.0.image.source.base64: The image was specified using the image/png media type, but the image appears to be a image/jpeg image"},"request_id":"req_011CZ8KCwCosjscuCSJP3bRY"}

Steps to Reproduce

  1. Open Claude Code desktop app
  2. Click the "+" button to attach an image
  3. Select a JPEG file (.jpg/.jpeg)
  4. Send the message

Expected Behavior

The app should detect the actual image format (JPEG, PNG, WebP, GIF) from the file extension or magic bytes and set the correct media_type in the API request.

Actual Behavior

The app always sends media_type: "image/png" regardless of the actual image format. The Anthropic API validates the magic bytes against the declared media type and rejects the request with a 400 error.

Workaround

  • Paste images from clipboard (Cmd+V) instead of using the "+" button
  • Convert JPEG to PNG before attaching

Environment

  • macOS Darwin 25.3.0 (Apple Silicon)
  • Claude Code desktop app

View original on GitHub ↗

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