Skip to content

Bedrock: file extension included in DocumentBlock name causes validation error #19964

Closed as not planned

Description

@taviooo

Description

Problem

When sending a message with a PDF attachment through the Bedrock provider, the file extension (e.g., .pdf) is included in the DocumentBlock.name field sent to the Bedrock Converse API. The dot character in the extension violates Bedrock's validation rules, which reject the request with:

The document file name can only contain alphanumeric characters, whitespace characters, hyphens, parentheses, and square brackets. The name can't contain more than one consecutive whitespace character.

Expected behavior

When constructing a DocumentBlock for the Bedrock Converse API, OpenCode should strip the file extension from the filename before using it as the name field. The extension/format should only be conveyed via the separate format field.

For example, given a file part with filename: "filename.pdf":

  • name should be "filename"
  • format should be "pdf"

Reference

The Bedrock DocumentBlock.name spec explicitly excludes dots and underscores from the allowed character set: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_DocumentBlock.html

Plugins

No response

OpenCode version

1.2.27

Steps to reproduce

  1. Configure OpenCode with a Bedrock provider
  2. Send a message with a PDF file attachment (e.g., filename.pdf)
  3. The request to Bedrock fails with the validation error above

Screenshot and/or share link

No response

Operating System

Linux (Ubuntu 22.04, kernel 6.8.0, x86_64, AWS)

Terminal

xterm-256color

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 30, 2026
  2. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  3. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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