chrome-devtools-mcp icon indicating copy to clipboard operation
chrome-devtools-mcp copied to clipboard

Bug: take_screenshot returns wrong MIME type for PNG format

Open amihos opened this issue 1 month ago • 4 comments

Description of the bug

Description

The take_screenshot tool declares image/jpeg media type in the response but actually returns PNG image data. This causes the Claude API to reject the image with a format mismatch error.

Error Message

Error: API error: Could not process image at index 0 Declared media_type is image/jpeg, but the data appears to be image/png

Reproduction

Steps to Reproduce

  1. Use the take_screenshot tool with default settings (format: "png")
  2. The tool returns image data
  3. The response declares image/jpeg media type
  4. Claude API rejects due to format mismatch

Environment

  • OS: WSL2 (Linux 5.15.167.4-microsoft-standard-WSL2)

Additional Context

The screenshot itself is captured correctly; only the MIME type declaration is wrong.

Expectation

Expected Behavior

  • When format: "png" → declare image/png
  • When format: "jpeg" → declare image/jpeg
  • When format: "webp" → declare image/webp

MCP configuration

{ "mcpServers": { "chrome-devtools": { "command": "npx", "args": ["-y", "chrome-devtools-mcp@latest"] } } }

Chrome DevTools MCP version

0.10.2

Chrome version

142.0.7444.59

Coding agent version

Claude Code CLI v2.0.46

Model version

Sonnet 4.5

Chat log

No response

Node version

v22.17.1

Operating system

Windows Subsystem for Linux (WSL)

Extra checklist

  • [ ] I want to provide a PR to fix this bug

amihos avatar Nov 19 '25 21:11 amihos

I think I have been running recently in this bug numerous times.

Bug Description chrome-devtools take_screenshot fails consistently with

⏺ chrome-devtools - take_screenshot (MCP)(format: "png")
  ⎿  # take_screenshot response
     Took a screenshot of the current page's viewport.
  ⎿  [Image]
  ⎿ API Error: 400
    {"type":"error","error":{"type":"invalid_request_error","message":"messages.13.content.3.image.source.base64.data:
    Image does not match the provided media type image/jpeg"},"request_id":"req_011CVM5UMAuiXMHSbNu6Mfn5"}

Environment Info

  • Platform: darwin
  • Terminal: iTerm.app
  • Version: 2.0.49
  • Feedback ID: 194dd997-1492-4a73-a4f6-11f68207de03

Errors

[{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/george.moldoveanu/.local/share/claude/versions/2.0.49 (expected in multi-process scenarios)\n    at BI0 (/$bunfs/root/claude:2556:1516)\n    at E$A (/$bunfs/root/claude:2556:1194)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-11-21T11:59:46.564Z"},{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/george.moldoveanu/.local/share/claude/versions/2.0.49 (expected in multi-process scenarios)\n    at BI0 (/$bunfs/root/claude:2556:1516)\n    at q$A (/$bunfs/root/claude:2554:12595)\n    at async Km8 (/$bunfs/root/claude:2554:13797)\n    at async Hx (/$bunfs/root/claude:2556:236)\n    at async <anonymous> (/$bunfs/root/claude:2556:12360)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-11-21T11:59:54.794Z"},{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/george.moldoveanu/.local/share/claude/versions/2.0.49 (expected in multi-process scenarios)\n    at BI0 (/$bunfs/root/claude:2556:1516)\n    at q$A (/$bunfs/root/claude:2554:12595)\n    at async Km8 (unknown)\n    at async Hx (unknown)\n    at unknown\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-11-21T12:00:22.582Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: \n    at NQ (/$bunfs/root/claude:1055:4471)\n    at <anonymous> (/$bunfs/root/claude:1055:4193)\n    at map (native:1:11)\n    at zJ (/$bunfs/root/claude:1055:4185)\n    at EuB (/$bunfs/root/claude:1768:3696)\n    at N7 (/$bunfs/root/claude:102:19666)\n    at EI (/$bunfs/root/claude:104:42843)\n    at TU (/$bunfs/root/claude:104:38376)\n    at TD (/$bunfs/root/claude:104:38304)\n    at kq (/$bunfs/root/claude:104:38158)","timestamp":"2025-11-21T12:23:54.055Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: \n    at NQ (/$bunfs/root/claude:1055:4471)\n    at <anonymous> (/$bunfs/root/claude:1055:4193)\n    at map (native:1:11)\n    at zJ (/$bunfs/root/claude:1055:4185)\n    at EuB (/$bunfs/root/claude:1768:3696)\n    at N7 (/$bunfs/root/claude:102:19666)\n    at EI (/$bunfs/root/claude:104:42843)\n    at TU (/$bunfs/root/claude:104:38376)\n    at TD (/$bunfs/root/claude:104:38304)\n    at kq (/$bunfs/root/claude:104:38158)","timestamp":"2025-11-21T12:23:54.058Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: \n    at NQ (/$bunfs/root/claude:1055:4471)\n    at <anonymous> (/$bunfs/root/claude:1055:4193)\n    at map (native:1:11)\n    at zJ (/$bunfs/root/claude:1055:4185)\n    at EuB (/$bunfs/root/claude:1768:3696)\n    at N7 (/$bunfs/root/claude:102:19666)\n    at EI (/$bunfs/root/claude:104:42843)\n    at TU (/$bunfs/root/claude:104:38376)\n    at TD (/$bunfs/root/claude:104:38304)\n    at kq (/$bunfs/root/claude:104:38158)","timestamp":"2025-11-21T12:23:54.058Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: \n    at NQ (/$bunfs/root/claude:1055:4471)\n    at <anonymous> (/$bunfs/root/claude:1055:4193)\n    at map (native:1:11)\n    at zJ (/$bunfs/root/claude:1055:4185)\n    at EuB (/$bunfs/root/claude:1768:3696)\n    at N7 (/$bunfs/root/claude:102:19666)\n    at EI (/$bunfs/root/claude:104:42843)\n    at TU (/$bunfs/root/claude:104:38376)\n    at TD (/$bunfs/root/claude:104:38304)\n    at kq (/$bunfs/root/claude:104:38158)","timestamp":"2025-11-21T12:31:42.303Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: \n    at NQ (/$bunfs/root/claude:1055:4471)\n    at <anonymous> (/$bunfs/root/claude:1055:4193)\n    at map (native:1:11)\n    at zJ (/$bunfs/root/claude:1055:4185)\n    at EuB (/$bunfs/root/claude:1768:3696)\n    at N7 (/$bunfs/root/claude:102:19666)\n    at EI (/$bunfs/root/claude:104:42843)\n    at TU (/$bunfs/root/claude:104:38376)\n    at TD (/$bunfs/root/claude:104:38304)\n    at kq (/$bunfs/ro

Note: Error logs were truncated.

mol-george avatar Nov 21 '25 13:11 mol-george

+1 I'm also getting this.

 ⎿  # take_screenshot response                                                                                                                                         
     Took a screenshot of the current page's viewport.
  ⎿  [Image]
  ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.5.content.7.image.source.base64.data: Image does not match the provided media 
    type image/jpeg"},"request_id":"req_011CVMMN37fCxA6QHGpEMxcg"}

I was on latest but tried downgrading to 0.10.0, still getting the error. I'm using Claude Code 2.0.49 on MacOS 15.7.2.

jon-frankel avatar Nov 21 '25 16:11 jon-frankel

I'm also seen this error

mdlufy avatar Nov 21 '25 23:11 mdlufy

@OrKoN what do we do with this issue? As far as I understand its Claude handling this wrong.

natorion avatar Dec 05 '25 15:12 natorion

Yeah, Claude is handling it wrong. I would suggest to work around it via a prompt / rule to request a jpeg image until it is solved in Claude.

OrKoN avatar Dec 16 '25 07:12 OrKoN