-
Notifications
You must be signed in to change notification settings - Fork 15.4k
ValidationException: text content blocks must be non-empty when using Bedrock Runtime #15715
Description
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
- Start a normal conversation session using opencode with AWS Bedrock as the provider
- Send a non-empty message
- 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