[Bug] Anthropic API Error: Image does not match provided media type

Resolved 💬 30 comments Opened Nov 19, 2025 by razurang Closed Jul 9, 2026
💡 Likely answer: A maintainer (localden, collaborator) responded on this thread — see the highlighted reply below.

Bug Description

Playwright MCP took screenshots in png format, but while API call, it's looking for image/JPEG format, it was working before, but now it's getting this error:

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","messag
e":"messages.5.content.28.image.source.base64.data: Image does not match the
provided media type image/jpeg"},"request_id":"req_011CVHseGP3vaiaFfNqeY4gQ"}

Environment Info

  • Platform: darwin
  • Terminal: vscode
  • Version: 2.0.46
  • Feedback ID: de2e8417-f5f2-4035-ad13-183b406bfcb2

Errors

[{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/razu/.local/share/claude/versions/2.0.46 (expected in multi-process scenarios)\n    at aq0 (/$bunfs/root/claude:2532:1516)\n    at P4A (/$bunfs/root/claude:2532:1194)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-11-19T20:17:38.589Z"},{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/razu/.local/share/claude/versions/2.0.46 (expected in multi-process scenarios)\n    at aq0 (/$bunfs/root/claude:2532:1516)\n    at N4A (/$bunfs/root/claude:2530:12601)\n    at async tp8 (/$bunfs/root/claude:2530:13807)\n    at async Ux (/$bunfs/root/claude:2532:236)\n    at async <anonymous> (/$bunfs/root/claude:2532:12383)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-11-19T20:17:48.464Z"},{"error":"Error: Could not load the \"sharp\" module using the darwin-arm64 runtime\nPossible solutions:\n- Ensure optional dependencies can be installed:\n    npm install --include=optional sharp\n- Ensure your package manager supports multi-platform installation:\n    See https://sharp.pixelplumbing.com/install#cross-platform\n- Add platform-specific dependencies:\n    npm install --os=darwin --cpu=arm64 sharp\n- Consult the installation documentation:\n    See https://sharp.pixelplumbing.com/install\n    at <anonymous> (/$bunfs/root/claude:339:36615)\n    at <anonymous> (/$bunfs/root/claude:11:356)\n    at <anonymous> (/$bunfs/root/claude:340:88)\n    at <anonymous> (/$bunfs/root/claude:11:356)\n    at <anonymous> (/$bunfs/root/claude:340:79804)\n    at <anonymous> (/$bunfs/root/claude:11:356)\n    at <anonymous> (/$bunfs/root/claude:340:80999)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-11-19T20:24:23.949Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.5.content.28.image.source.base64.data: Image does not match the provided media type image/jpeg\"},\"request_id\":\"req_011CVHseGP3vaiaFfNqeY4gQ\"}\n    at generate (/$bunfs/root/claude:390:20036)\n    at makeRequest (/$bunfs/root/claude:732:5434)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-11-19T20:24:26.333Z"}]

View original on GitHub ↗

30 Comments

razurang · 7 months ago

After this API error, if you send a new message, you get the same API error again with a new request_id. That means the Claude Code session is dead, and you can’t continue. You’re stuck. You have to open a new session to use Claude Code again.

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/11936
  3. https://github.com/anthropics/claude-code/issues/11967

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

aliesenli · 7 months ago

I'm experiencing the same issue while using the Figma MCP and attempting to capture a screenshot.
Also related: https://github.com/anthropics/claude-code/issues/11908

darkguy2008 · 7 months ago

I am getting the same thing with chrome devtools mcp

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

I'd consider this a critical/blocker bug because it crashes our current sessions and then we need to start over again, the experience is way subpar now...

Edit: Since I really need this working and can't wait until they fix it, I made some scripts to downgrade/restore claude code in the meantime. It doesn't happen with 2.0.44...

https://github.com/anthropics/claude-code/issues/11908#issuecomment-3554847291

MilesNorton · 7 months ago

Seeing this with version 2.0.46

> go to google.com and use playwright to take a picture

● I'll navigate to Google and take a screenshot for you.

● playwright - Navigate to a URL (MCP)(url: "https://www.google.com")
  ⎿  ### Ran Playwright code
     ```js
     await page.goto('https://www.google.com');
     … +61 lines (ctrl+o to expand)

● Now let me take a screenshot:

● playwright - Take a screenshot (MCP)(filename: "google-homepage.png", fullPage: false)
  ⎿  ### Result
     … +9 lines (ctrl+o to expand)
  ⎿  [Image]
  ⎿  API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.23.content.3.image.source.base64.data: Image does not match the provided media type image/jpeg"},"request_id":"req_011CVJ3THAHUx1H4cvwvPFp7"}
 ❯ claude doctor

 Diagnostics
 └ Currently running: native (2.0.46)
 └ Path: /home/miles/.local/bin/claude
 └ Invoked: /home/miles/.local/share/claude/versions/2.0.46
 └ Config install method: native
 └ Auto-updates: default (true)
 └ Search: OK (bundled)
xpluscal · 7 months ago

Same here in 2.0.47, affets all our image gen mcps.

MilesNorton · 7 months ago

Downgrading to 2.0.30 with claude install 2.0.30 helps if someone needs to bypass it

coygeek · 7 months ago

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

Both occur when taking an image.

94wogus-quantit · 7 months ago

@MilesNorton
thanks you. i can continue with the work.

jonaslejon · 7 months ago

Same errors here using the playwright MCP server to take screenshots of webpages.

Claude Code Version: 2.0.47

● playwright - Take a screenshot (MCP)(element: "Screenshot section showing image", ref: "e441", filename: "screenshot-section-404-error.png")
  ⎿ ### Result
    Took the Screenshot section showing image screenshot and saved it as /home/je/scanmalware/.playwright-mcp/screenshot-section-404-error.pn
    g
    … +9 lines (ctrl+o to expand)

  ⎿  [Image]
  ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.5.content.5.image.source.base64.data: Image does
    not match the provided media type image/jpeg"},"request_id":"req_011CVJrFe9Ux95AH7LRZJDJA"}
onurorhon · 7 months ago

I've also started getting this error while trying to use Figma's MCP (which I've used many times before). Both in Claude Code in terminal, and also when using Sonnet 4.5 as the selected agent in Cursor.

jonattanvargas-habi · 7 months ago

I have the same issues with claude code :(

silverl · 7 months ago

+1 here. Same issue.

mattborn · 7 months ago

This is a pretty significant blocker and pretty bad for anyone who has become reliant on the MCP. I exported a screenshot to my working directory manually, but I cannot use the metadata it fetches successfully since the screenshot call is required. Curious if there is a way to remove or bypass that requirement.

razurang · 7 months ago

I figured out a temporary solution, and it worked for me.
Ask Claude Code to change the screenshot format from PNG to JPEG for Playwright MCP, and it will update the necessary code in screenshot.js. Then restart Claude Code. If Claude Code tries to take a screenshot with Playwright MCP, simply press Esc and tell it to take the screenshot in JPEG format. That’s it — it will look for the JPG format and should work again.

Let me know if it works for you as well.

Thank you.

corby · 7 months ago

Edit your ~/.claude.json where your mcp config is set:

    "chrome-devtools": {
      "command": "npx",
      "args": [
        "chrome-devtools-mcp@latest"
      ],
      "commands": {
        "take_snapshot": {
          "defaultArgs": {
            "format": "jpeg",
            "quality": 90
          }
        }
      }
    }
onurorhon · 7 months ago

Tried this for Figma's MCP and unfortunately it didn't work @corby.

onurorhon · 7 months ago

Version: 2.0.50 seems to have fixed it, at least for Figma's MCP.

Humni · 7 months ago

I was still getting this error in 2.0.50.

Add this code to force the tool to use jpeg format, this resolves it for both Playwrite and Chrome Dev Tools

Chrome Dev Tools MCP

  1. Add to .claude/hooks/chromedevtools-screenshot-guard.py
#!/usr/bin/env python3
import sys, json

def main():
    input_data = json.load(sys.stdin)
    tool_name = input_data.get("tool_name", "")
    tool_input = input_data.get("tool_input", {})

    # Block non-JPEG screenshots
    if "mcp__chrome-devtools__take_screenshot" in tool_name:
        screenshot_format = tool_input.get("format", "png")

        if screenshot_format != "jpeg":
            print("🚫 BLOCKED: Chrome DevTools screenshot must use JPEG format", file=sys.stderr)
            print("", file=sys.stderr)
            print("Solution: Set format='jpeg' in take_screenshot", file=sys.stderr)
            print(f"Current: format='{screenshot_format}' ❌", file=sys.stderr)
            print("Required: format='jpeg' ✅", file=sys.stderr)
            sys.exit(2)  # Block tool execution

    sys.exit(0)  # Allow

if __name__ == "__main__":
    main()
  1. Make the file executable
chmod +x .claude/hooks/chromedevtools-screenshot-guard.py
  1. Update .claude/settings.json
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "mcp__chrome-devtools__take_screenshot",
        "hooks": [
          {
            "type": "command",
            "command": ".claude/hooks/chromedevtools-screenshot-guard.py",
            "timeout": 5000
          }
        ]
      }
    ]
  }
}

Playwrite MCP

Credit to @Sceat for this discovery

See full details here

Sceat · 7 months ago

@Humni well credit to Claude, he found that by himself 😆

cmujie · 7 months ago

@Humni will give this a try. It has been driving me nuts.

janss-en · 7 months ago

Seeing this bug when Claude attempts to read an image, even without using an MCP. Example:

⏺ Read(temp/article-sessions/issue-82/images/
raw/PFH18HSPVMC_06.jpg)
⎿  Read image (230.4KB)
⎿ API Error: 400
{"type":"error","error":{"type":"invalid_
request_error","message":"messages.3.cont
ent.21.image.source.base64.data: Image
does not match the provided media type
image/jpeg"},"request_id":"req_011CVjEtb4
8ua18B11gWXgjQ"}

Still seeing the issue on 2.0.56.

tonydehnke · 7 months ago

Ran into this today with 2.0.59

Claude gets stuck and you can't tell it to skip or bypass the image, so you have to /clear the conversation and start all over again.

Claude should gracefully bypass the image, report to the user the file name and issue and allow the user to fix it, skip it and continue, etc.

In my case it was images with the wrong extension, something simple enough that Claude should have been able to skip, bypass or deal with.

``API Error: 400
f"type": "error", "error": {"type":"invalid_request_error","
message": "messages. 13. content.5. image.source.base64.data:
Image does not match the provided media type
image/jpeg"}, "request_id": "req_011CVo58ve6dbpwnDwL46v56"}
``

onurorhon · 7 months ago

Have you tried rewinding to an earlier checkpoint? It has helped me in the past when Claude froze after an MCP error.

palmentropyc · 7 months ago

Confirming this issue on v2.0.71

I encountered the exact same "soft-lock" loop today.

Claude Code read a file named logo.png which apparently had a mismatching MIME type (likely a WebP or JPEG saved with a .png extension).

The API returned a 400 error: Invalid request error: image does not match the provided media type image/png.

When I tried to issue a command to fix it (e.g., do not read images or /clear), Claude Code seemingly re-sent the corrupted context history before processing the new command, triggering the 400 error again immediately.

I was unable to recover the session and had to kill the process.

Environment:

Claude Code v2.0.71

OS: Mac

Error: messages.x.content.x.image.source.base64.data: Image does not match the provided media type image/png

github-actions[bot] · 6 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

tayoonabule · 5 months ago

Still finding the same issue here!

gethooo · 5 months ago

This issue arose for me because I changed the mac default screenshot format from PNG to jpeg. Claude is assuming that anything pasted is a PNG. It needs to check.

jordin-marshall · 4 months ago

The same happens anytime you use the iOS app with Claude code. Uploading an image shatters the session

localden collaborator · 7 days ago

Three separate things were going on here. The MCP compression regression was fixed in v2.0.50, wrong-extension images from Read/paste/iOS in v2.1.116, and the session soft-lock in v2.1.142. No reports since May so closing this out. Reopen with version + --debug if it shows up on 2.1.142 or later.