MCP tool returning ImageContent with unsupported MIME type permanently breaks conversation (400 Could not process image)
Summary
When an MCP tool returns an ImageContent with an unsupported MIME type (e.g. image/svg+xml), Claude Code adds it to conversation history as-is. Every subsequent API call replays that history and fails with 400 Could not process image, making the session completely unrecoverable — even a simple \"hi\" fails.
Steps to reproduce
- Have an MCP server return a tool result containing:
``json``
{"type": "image", "data": "<base64>", "mimeType": "image/svg+xml"}
- Claude Code includes this
ImageContentin the conversation history. - On the next turn, the API call includes the SVG image in history and returns
400 Could not process image. - Every subsequent message — regardless of content — fails with the same error.
- The only recovery is starting a brand new conversation.
Root cause
Two independent failures:
1. No MIME type validation on MCP tool results. The Claude API only accepts image/png, image/jpeg, image/gif, and image/webp as inline image content. Claude Code should validate (or allowlist) MIME types from MCP ImageContent results before adding them to conversation history. An unsupported type should be dropped, converted to a text fallback, or flagged — not silently forwarded to the API.
2. No recovery path when an API 400 is caused by history content. When the API rejects a call due to a specific piece of content in history, Claude Code should be able to identify the offending message, skip or strip it, and retry. At minimum it should surface _which_ message is causing the problem and offer the user a way to remove it, rather than hard-locking the session indefinitely.
Impact
Any MCP server that returns ImageContent with a non-standard MIME type (SVG, PDF, etc.) will permanently break the session for the user. This is easy to hit accidentally — e.g. a rendering tool that returns both PNG and SVG results.
Expected behaviour
- Claude Code rejects or drops
ImageContentwith unsupported MIME types at the point the MCP result is received, before it enters conversation history. - If a 400 error is caused by history content, Claude Code recovers gracefully (strips the offending content and retries, or prompts the user).
Context
Discovered via the build123d-mcp server, which was returning SVG as ImageContent(mimeType="image/svg+xml"). Fixed on the server side in v0.3.19, but the client should be resilient to this regardless of what MCP servers send.
4 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
The flagged duplicates (#28279, #15807) were both closed by the stale-issue bot without being fixed — not because the bug was resolved. This is the same unfixed bug resurfacing.
Leaving this open as a fresh report with a clean reproduction case. The core issue (unsupported MIME types from MCP tools permanently bricking sessions) remains unaddressed in the client.
we just bumped into this issue, too so adding a +1
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.