Skip to content

mcp: binary file attachment in tool result permanently breaks the session #52448

Closed

Description

@janlavicka

Description

An MCP tool result with a type: "file" content item whose media type the provider can't inline (e.g. application/vnd.apache.parquet) is persisted into session history. The next model request fails:

AI.Error: OpenAI Chat does not support media type application/vnd.apache.parquet
  at OpenAIChat.lowerMedia
  at OpenAIChat.lowerToolMessages

Every later turn in that session fails the same way while replaying history — the session becomes permanently unusable, even for unrelated messages. Expected: unsupported file items dropped or converted to text at persistence time (byte materialization to a local file would be a bonus), or tolerated during lowering.

OpenCode version

2.0.21

Steps to reproduce

  1. Configure an MCP server whose tool returns a binary attachment (a file read returning { type: "file", mime: "application/vnd.apache.parquet", uri: "data:...;base64,..." } works).
  2. Call it in a session on an OpenAI Chat provider.
  3. Tool completes, then every request — including follow-ups about something else — fails with the error above.

Operating System

macOS 15.6 (Darwin 24.6.0, arm64)

Terminal

xterm-256color

Activity

  1. github-actions commented on Oct 1, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    • #30249: MCP tool results with non-image binary content crash the session.
    • #39824: Media in tool results can bypass model capability checks and permanently brick a session.
    • #48868: A PDF tool result causes replay failures and leaves an OpenAI-compatible-provider session stuck.
    • #37191: An MCP binary attachment persists in history and causes every subsequent Bedrock request to fail.
  2. vladislav-miroshnikov commented on Oct 1, 2026

    @vladislav-miroshnikov

    I reproduced this in v2's Chat request compiler with Parquet and CSV and opened #52517. The fix keeps the original files in history and sends Chat an omission note instead, so follow-ups can continue. The compiled Parquet and follow-up requests also completed against OpenAI. If you can try it with your MCP server, let me know how it goes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions