Skip to content

[BUG]: Bedrock provider hangs indefinitely on all model calls in v1.16.0 #30858

@alblez

Description

@alblez

Bug Report: opencode 1.16.0 — Bedrock Provider Hangs on All Model Calls

Summary

opencode v1.16.0's Amazon Bedrock provider hangs indefinitely on all model invocations, while the same AWS credentials and model IDs work correctly via the AWS CLI (aws bedrock-runtime converse).

Environment

  • opencode version: 1.16.0 (installed via Homebrew)
  • OS: macOS Darwin 25.5.0 arm64
  • AWS CLI: v2 (working)
  • Auth method: AWS SSO (aws sso login --profile bedrock)
  • Region: us-east-1
  • Profile: bedrock

Steps to Reproduce

1. Configure provider

{
  "provider": {
    "amazon-bedrock": {
      "options": {
        "region": "us-east-1",
        "profile": "bedrock"
      }
    }
  }
}

2. Verify AWS CLI works

aws bedrock-runtime converse \
  --model-id us.anthropic.claude-opus-4-6-v1 \
  --profile bedrock --region us-east-1 \
  --messages '[{"role":"user","content":[{"text":"test"}]}]'
# ✅ Returns response immediately

3. Run opencode — hangs

opencode run --model amazon-bedrock/anthropic.claude-opus-4-6-v1 "test"
# ❌ Hangs indefinitely, no output, no error

Affected Models

All Bedrock models tested hang:

  • anthropic.claude-opus-4-6-v1 (requires inference profile)
  • us.anthropic.claude-opus-4-6-v1 (inference profile)
  • global.anthropic.claude-opus-4-6-v1 (inference profile)
  • anthropic.claude-opus-4-5-20251101-v1:0 (on-demand)
  • anthropic.claude-sonnet-4-5-20250929-v1:0 (on-demand)
  • anthropic.claude-haiku-4-5-20251001-v1:0 (on-demand)

Debug Output

With --log-level DEBUG --print-logs, the last log line before hang is:

service=provider status=completed duration=0 providerID=amazon-bedrock getSDK
service=llm providerID=amazon-bedrock modelID=anthropic.claude-haiku-4-5-20251001-v1:0 ... stream

The SDK initializes successfully, but the LLM stream never produces output or errors.

Key Observations

  1. AWS side is not the problem: aws bedrock-runtime converse works with the same credentials, model IDs, and regions.
  2. Inference profile vs on-demand: opus-4-6 requires inference profile (not on-demand), but the hang occurs even with on-demand models like haiku-4-5.
  3. No timeout: opencode hangs indefinitely without error or timeout.
  4. Other providers work: MiMo (when key valid) responds, confirming the issue is Bedrock-specific.

Expected Behavior

opencode should either:

  • Successfully stream the response
  • Or error with a meaningful message (e.g., "requires inference profile", "timeout", "auth error")

Actual Behavior

Complete hang — no output, no error, no timeout. Process must be manually killed.

Workaround

Use AWS CLI directly as a temporary replacement:

aws bedrock-runtime converse \
  --profile bedrock \
  --region us-east-1 \
  --model-id us.anthropic.claude-opus-4-6-v1 \
  --messages '[{"role":"user","content":[{"text":"your prompt"}]}]'

Or use the wrapper script at ~/.config/opencode/opencode-bedrock-workaround.sh.

Severity

High — Completely blocks Bedrock usage in opencode. No workaround within the tool itself.

Possible Cause

Likely a regression in the @ai-sdk/amazon-bedrock provider integration in v1.16.0. The SDK initializes but the streaming implementation may be stuck in an async loop, waiting for an event that never fires, or failing to handle the Bedrock Converse API response format correctly.

Additional Context

  • The AWS SSO token is valid (verified via aws sts get-caller-identity).
  • The same issue occurs with --pure flag (no external plugins).
  • The issue occurs in both run and interactive TUI modes.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions