anomalyco / anomalyco/opencode

Bedrock: 2.0.4 requires AWS_REGION despite a configured provider region

Open
#49,391 1 comment 0 reactions 1 assignee View on GitHub

@rekram1-node is already working on this.

Since Sep 16, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

After upgrading from 2.0.3 to 2.0.4, Bedrock model initialization started failing with an error about AWS_REGION being required. The matching error in the source is:

Cannot initialize amazon-bedrock/<model>: AWS_REGION is required to resolve the provider endpoint

Expected: Bedrock Mantle endpoint templates should use the configured/default provider region without requiring a separate AWS_REGION environment variable.

The likely regression is #48943, commit 2226afaea5. In 2.0.3, AISDKNative.map ran during model resolution, after provider/model settings were merged. In 2.0.4, AISDKNative.rewrite runs separately on provider/model writes. A provider-level region and model-level baseURL containing ${AWS_REGION} are therefore normalized separately, then merged too late for the placeholder substitution. ModelResolver.prepareProviderURL subsequently checks only process.env and rejects the unresolved URL.

cc @rekram1-node — could you take a look at this possible regression from #48943?

OpenCode version

Reported working: 2.0.3. Reported broken: 2.0.4. Currently running 2.0.3 again. The relevant implementation is also unchanged in the 2.0.5 source inspected.

The merged settings contain a region, but endpoint validation can still fail before AWS credential resolution. Existing region tests provide region and baseURL together in one model settings object, so they do not cover this split provider/model case.

Plugins

No response

OpenCode version

2.0.4-2.0.5

Steps to reproduce
  1. Configure Bedrock with a working AWS profile and a provider-level region, such as us-west-2.
  2. Leave AWS_REGION unset in the server process environment.
  3. Select a Mantle model whose catalog entry supplies a model-level endpoint such as https://bedrock-mantle.${AWS_REGION}.api.aws/openai/v1.
  4. Submit a prompt on 2.0.4.
Screenshot and/or share link

No response

Operating System

Linux x86_64, kernel 6.12

Terminal

tmux (TERM=xterm-256color, COLORTERM=truecolor), zsh. Diagnostics collected after returning to 2.0.3.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.