Skip to content

ValidationException: text content blocks must be non-empty when using Bedrock Runtime #15715

Description

@icodeu

Description

Description

When using opencode with AWS Bedrock Runtime (InvokeModelWithResponseStream), a ValidationException is thrown with the message:

messages: text content blocks must be non-empty
This error occurs during normal conversation — no empty message was sent by the user. It appears opencode is generating a request that contains an empty text content block, which Bedrock rejects.

Error Message

InvokeModelWithResponseStream: operation error Bedrock Runtime: InvokeModelWithResponseStream,
https response error StatusCode: 400,
RequestID: 1864b9d1-6a4d-441b-a404-46e48820db57,
ValidationException: messages: text content blocks must be non-empty

Steps to Reproduce

  1. Start a normal conversation session using opencode with AWS Bedrock as the provider
  2. Send a non-empty message
  3. Error occurs consistently on every request

Expected Behavior

Messages are sent to Bedrock API with valid, non-empty text content blocks.

Actual Behavior

Bedrock returns HTTP 400 with ValidationException: messages: text content blocks must be non-empty, suggesting opencode is including an empty text block in the API request body.

Environment

  • Platform: macOS (darwin)
  • Provider: AWS Bedrock Runtime
  • Model: Claude Sonnet 4.6
  • Provider: Custom Provider

Possible Cause

opencode may be including empty text content blocks (e.g. {"type": "text", "text": ""}) in the messages array when constructing the API request, possibly related to tool use results or message history serialization.

Plugins

No response

OpenCode version

1.2.15

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 2, 2026
  2. github-actions commented on Mar 2, 2026

    @github-actions
    Contributor

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

    Please review those issues to see if they describe the same root cause. If your issue is distinct, feel free to explain how it differs.

  3. added a commit that references this issue on Mar 3, 2026
    bf68e93
  4. assigned and unassigned on Apr 26, 2026
  5. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  6. 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