Skip to content

AWS Bedrock via openai-compatible provider rejects empty assistant content #17395

Closed

Description

@JackFGreen

Description

When using AWS Bedrock (Anthropic models) through the openai-compatible provider, the API rejects assistant messages that have content: "". This causes the agent to fail when it makes tool calls without accompanying text.

Steps to Reproduce

  1. Configure AWS Bedrock with an Anthropic model using the openai-compatible provider
  2. Send a message that triggers tool calls where the assistant response contains only tool calls (no text)
  3. The AI SDK serializes the content as an empty string ""
  4. Bedrock API rejects the request with an error about empty content

Expected Behavior

The request should be accepted by the Bedrock API, similar to how native Anthropic and Bedrock providers handle this case.

Actual Behavior

The API rejects the request due to content: "" in assistant messages.

Environment

  • Provider: AWS Bedrock via openai-compatible
  • Models: Anthropic models (Claude)
  • Issue occurs when assistant has only tool calls without text response

Proposed Solution

  • Transform empty assistant content ("") to null for openai-compatible providers
  • Extend existing empty content filtering to openai-compatible provider
  • Handle edge cases with tool outputs and empty text blocks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions