[Bug] Anthropic API Error: PNG screenshots sent with incorrect image/jpeg MIME type
Bug Description
When using the MCP Playwright server within the Claude Code environment (VSCode extension), a persistent invalid_request_error occurs when attempting to transmit screenshots to the Anthropic API. The issue manifests as an incorrect MIME type specification: PNG screenshots are transmitted with an image/jpeg media type declaration, which blocks all subsequent requests within the current conversation
Environment Info
- Platform: win32
- Terminal: vscode
- Version: 2.0.31
- Feedback ID: 51270c65-5715-4f04-b9dc-83c4b73dfbb4
Errors
[]
Steps to Reproduce
Step 1: Screenshot Initialization
Tool invocation:
{
"tool": "mcp_playwright_browser_take_screenshot",
"parameters": {
"fullPage": true,
"filename": "all-post-operative-control-page.png"
}
}
### Step 2: Error Manifestation
When attempting to continue the conversation, the following error occurs:
messages.7.content.17.image.source.base64.data:
Image does not match the provided media type image/jpeg
### Step 3: Issue Persistence
The error reproduces with every subsequent request within the current conversation, even without repeated calls to MCP Playwright.
---
## 4. Diagnostic Data
### 4.1. Log Fragments (Output → Claude)
2025-11-19T08:30:26.821Z [ERROR] Error streaming, falling back to non-streaming mode: 400
{
"type":"error",
"error":{
"type":"invalid_request_error",
"message":"messages.7.content.17.image.source.base64.data: Image does not match the provided media type image/jpeg"
},
"request_id":"req_011CVGwCPUBQVhbin6DfhmxU"
}
2025-11-19T08:30:27.493Z [ERROR] Error in non-streaming fallback: 400
{
"type":"error",
"error":{
"type":"invalid_request_error",
"message":"messages.7.content.17.image.source.base64.data: Image does not match the provided media type image/jpeg"
},
"request_id":"req_011CVGwCTFPUKyg9MdCjc8p1"
}
2025-11-19T08:30:27.493Z [ERROR]
"Error: Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.7.content.17.image.source.base64.data: Image does not match the provided media type image/jpeg\"},\"request_id\":\"req_011CVGwCTFPUKyg9MdCjc8p1\"}\n
at generate (B:/~BUN/root/claude.exe:389:20036)\n
at makeRequest (B:/~BUN/root/claude.exe:731:5434)\n
at processTicksAndRejections (native:7:39)"
### 4.2. Additional Information
2025-11-19T08:30:26.821Z [DEBUG] CLAUDE_CODE_MAX_OUTPUT_TOKENS Capped from 200000 to 64000
11 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
I have the same problem.
<img width="1917" height="366" alt="Image" src="https://github.com/user-attachments/assets/2ff77fae-f1a9-4ec9-bb01-0d7739f284f4" />
How do I continue working with Claude Code further in this case?
<img width="1915" height="459" alt="Image" src="https://github.com/user-attachments/assets/a81c5fce-b7fc-4214-b40b-046c3865c41b" />
+1
Workaround: PreToolUse Hook to Block PNG Screenshots
The root cause is a Playwright MCP bug where PNG screenshots are incorrectly declared with
image/jpegmedia type, causing API rejections.Solution: Use a PreToolUse hook to block non-JPEG screenshot requests and force Claude to use JPEG format.
Setup
.claude/hooks/playwright-screenshot-guard.py:chmod +x .claude/hooks/playwright-screenshot-guard.py.claude/settings.json:Result: Claude will be blocked from taking PNG screenshots and forced to use
type='jpeg', which works correctly with the Anthropic API.Tested and verified - no more media type mismatch errors.
just wanted to say thank you for this
This should be fixed in version
2.0.46. So sorry for the friction, and thank you for reporting!Doesn't seem to be fixed, still occurring in 2.0.47
Not fixed.
Can confirm, still seeing this on 2.0.47.
Downgrading my VS Code extension to 2.0.36 doesn't work per guidance, I then get:
Just resolved to telling Claude to tell me when to take screenshots and then I paste them into VS Code for it. Annoying but I am hoping this gets patched soon.
another user suggested downgrading the cli to 2.0.30 https://github.com/anthropics/claude-code/issues/11975#issuecomment-3555784241
i tried that and im not getting that error anymore.
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.