Skip to content

Reading a PDF file via the Read tool corrupts session when using Amazon Bedrock — unrecoverable error #26087

Closed

Description

@MKovacik

Description

When the Read tool is used on a PDF (or other binary file), OpenCode stores
the binary content as a file-data tool result in the session history.
Amazon Bedrock's AI SDK does not support file-data content parts in tool
results, so every subsequent LLM call in the session fails immediately with
an unrecoverable error. The session cannot be resumed.

Plugins

No response

OpenCode version

OpenCode version: 1.14.39

Steps to reproduce

  1. Use OpenCode with the Amazon Bedrock provider (model: eu.anthropic.claude-sonnet-4-6)
  2. In a session, ask the AI to read a PDF file — e.g. "look at this file: path/to/file.pdf"
  3. The AI calls the Read tool on the PDF; OpenCode reads it and stores the
    binary content as a file-data part in the tool result
  4. On the next LLM turn, OpenCode sends the full conversation history
    (including the binary blob) to Bedrock
  5. The session crashes and becomes permanently unrecoverable

Screenshot and/or share link

No response

Operating System

OS: macOS 26.4.1 (Build 25E253), Provider: Amazon Bedrock, Model: eu.anthropic.claude-sonnet-4-6

Terminal

warp and ghosty

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