[Bug] Anthropic API Error: Image media type mismatch with base64 data

Resolved 💬 28 comments Opened Nov 19, 2025 by morphaven Closed Nov 25, 2025

Bug Description
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.3.content.10.image.source.base64.data: Image does not match the provided media type image/jpeg"},"request_id":"req_011CVHBL3QHdhdaeVDGdstBx"}

Environment Info

  • Platform: win32
  • Terminal: vscode
  • Version: 2.0.45
  • Feedback ID: 231d7c87-6426-4a3c-9a5d-edabcb43731f

Errors

[]

The new chat (after the patch) was tested and there was no problem at first, but it happened again. I wasn't doing anything specific when it occurred.

---

✅ ROOT CAUSE IDENTIFIED - Requires Anthropic Fix

Problem Summary

Claude Code does NOT pass the type parameter when calling Playwright MCP's browser_take_screenshot tool, causing it to default to PNG. However, Claude Code then sends this PNG image to Anthropic API with image/jpeg MIME type header, resulting in the error:

Image does not match the provided media type image/jpeg

Root Cause Analysis

From Playwright MCP documentation:

browser_take_screenshot
  - type (string, optional): Image format for the screenshot. **Default is png.**

The bug: Claude Code fails to specify type: "jpeg" when calling this tool, so Playwright defaults to PNG.

Evidence: Even when explicitly instructing Claude to use JPEG format, the actual tool call still defaults to PNG:

{
  "filename": "payment-modal-issue.png"  // Still PNG!
}

Current Workarounds

❌ What DOESN'T Work:
  • Telling Claude "use JPEG format" - Claude still sends PNG
  • Creating .claude/instructions.md - Claude ignores it for MCP tool parameters
  • Modifying Playwright MCP config - No option to change default screenshot type
⚠️ Only Temporary Workaround:

Use /rewind after the error occurs to go back and continue without screenshot. This is NOT a solution, just damage control.

Proof of Concept

When type: "jpeg" parameter is properly set by Claude Code, it works:

await page.screenshot({
  quality: 90,
  scale: 'css',
  type: 'jpeg'  // ✅ Matches API expectation
});

Required Fix (For Anthropic Team)

Option 1 (Recommended): Modify Claude Code to ALWAYS pass type: "jpeg" when calling mcp__playwright__browser_take_screenshot

Option 2: Fix the MIME type detection - inspect actual image format before setting the header instead of hardcoding image/jpeg

Option 3: Coordinate with Microsoft to make Playwright MCP default to JPEG instead of PNG

Test Results

  • ❌ Default behavior (no type specified) → PNG → API Error
  • ❌ Verbal instruction "use JPEG" → PNG → API Error
  • ❌ Custom instructions file → PNG → API Error
  • ✅ Manual code edit (type: "jpeg") → JPEG → Works perfectly

This bug affects ALL Playwright MCP users and requires a code-level fix in Claude Code itself. There is currently NO reliable user-side workaround.

---

🎉 UPDATE: Possibly Fixed in Version 2.0.50

After updating to Claude Code v2.0.50, PNG screenshots appear to work without errors. The fix mentioned in the changelog:

"Fixed bug preventing calling MCP tools that have nested references in their input schemas"

...may have resolved this issue, though we're not 100% certain this was the specific fix. PNG screenshots now successfully send to the API without MIME type mismatch errors.

Test Results (v2.0.50):

  • ✅ PNG screenshots → Working (no API error)
  • ✅ JPEG screenshots → Working

If you're experiencing this issue, please update to v2.0.50 or later.

Thank you to the Anthropic team for the quick fix! 🙏

---

Additional Environment Info:

  • Also confirmed on: Windows 11 & macOS
  • Playwright MCP: @playwright/mcp@latest
  • Fixed in: v2.0.50 (possibly)

View original on GitHub ↗

28 Comments

github-actions[bot] · 7 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/11931
  2. https://github.com/anthropics/claude-code/issues/3175
  3. https://github.com/anthropics/claude-code/issues/6300

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

bernardost · 7 months ago

Getting the same error using Playwright and Figma MCP. When Claude tries to get a screenshot using the Figma MCP, it throws the same error:

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","mess
age":"messages.1.content.7.image.source.base64.data: Image does not match
the provided media type
image/jpeg"},"request_id":"req_011CVHJonhbjdGrxSYSMM1z1"}

  • Platform: Mac
  • Terminal: vscode
  • Claude Code version: 2.0.46
Prains · 7 months ago

same

sen-io · 7 months ago

Same

phuchuynhStrong · 7 months ago

Same error here. Literally cannot use it to inspect figma with dev mode mcp at the moment

94wogus-quantit · 7 months ago

same here

coygeek · 7 months ago

Im seeing the same error with both Playright MCP and Chrome Devtools MCP.

Both occur when taking an image.

wowzql · 7 months ago

same

bkuzmic · 7 months ago

same

kt057 · 7 months ago

same

paulsowman · 7 months ago

same error

frane · 7 months ago

I'm experiencing the same issue on Mac with Claude Code in Terminal.

playwright - Take a screenshot (MCP)(filename: "redacted.png")
  ⎿ ### Result
    Took the viewport screenshot and saved it as redacted.png
    … +10 lines (ctrl+o to expand)

  ⎿  [Image]
  ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","mess
    age":"messages.5.content.10.image.source.base64.data: Image does not match
    the provided media type
    image/jpeg"},"request_id":"req_011CVLiCKaXDaJChtp4huvEq"}

Explicitly telling Claude to "if you do screenshots, save them as jpeg" or pasting JPEG files directly seems to work and can be used as a workaround. The issue seems to be only with PNG which is for some reason recognized/processed as JPEG.

hamzajfr · 7 months ago

Same

Lacsw · 7 months ago

Same, during MCP Figma connection

bingbing-ba · 7 months ago

Same during MCP Figma connection

bigdev-work · 7 months ago

sameeeeeee here, it doesn't work with Figma devmode MCP

fysnerd · 7 months ago

same here

mantey-github · 7 months ago

same

sibidharan · 7 months ago
"if you do screenshots, save them as jpeg"

this works thanks! added it to the Claude.MD for workaround

AmaStephano · 7 months ago

having the same issue when using Figma MCP. this is a huge blocker.

jaredutah · 7 months ago

Same issue, Figma MCP

AmaStephano · 7 months ago

I am not finding a workaround for the Figma MCP. And this previously worked without issues.

milkosten · 7 months ago

Just got the same, CC is updated.

onurorhon · 7 months ago

Seems like it's been fixed in Version: 2.0.50 – at least for Figma's MCP.

jurb · 7 months ago
Seems like it's been fixed in Version: 2.0.50 – at least for Figma's MCP.

not for the Chrome MCP it is, just tested this

rajsvadi · 7 months ago

Working after upgrading to Version 2.0.53, no issue with Playwright

SG-REUNI · 7 months ago

just came across the same issue still aint fixed yet?

github-actions[bot] · 7 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.