Repository navigation
Description
Summary
Status: Confirmed, reproduced, root cause isolated to a specific missing code path. Not yet filed upstream.
Affected version: v0.18.54 (also present in v0.18.42–v0.18.52; the relevant code is unchanged across that range — see "Version scope" below).
Affects: Any self-hosted OpenWork EE deployment using the dashboard's "Bring Your Own Keys" → Amazon Bedrock custom LLM provider (Settings → AI Gateway → AI Providers → Legacy Providers, route /dashboard/custom-llm-providers/:id).
Does not affect: The newer "AI Gateway" credential-set feature (a different, parallel code path that validates and forwards region correctly — see below). Org-hosted/managed models that aren't Bedrock-backed are unaffected.
No credentials, tokens, account IDs, or other secret material are included anywhere in this document.
Summary
A self-hosted org connects an Amazon Bedrock provider via Bring Your Own Keys (BYOK), supplying AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION, and AWS_BEARER_TOKEN_BEDROCK. The dashboard confirms the credential as "Saved" and the desktop app's own Settings → Environment panel confirms all four variables, under app-assigned namespaced names (e.g. LPR_NCEED_AWS_REGION), are correctly present on-device with the expected values.
Despite this, every chat request against every model attached to that provider fails, regardless of which specific Bedrock model is selected (tested with both a plain, single-region model ID and a cross-region "global." inference-profile model ID — both failed identically), with:
ProviderModelNotFoundError: Model not found: <llmProviderId>/<modelId>.
...
AWS region setting is missing. Pass it using the 'region' parameter or the
AWS_REGION environment variable.
The inner message is the Vercel AI SDK's generic loadSetting error text, the same template used by other @ai-sdk/* provider packages (confirmed by its exact phrasing pattern, which also appears verbatim in @ai-sdk/google-vertex's own tests). It fires because the underlying Bedrock client is constructed without a region option and finds no AWS_REGION in process.env — because the only region value actually present in the process environment is named LPR_NCEED_AWS_REGION, not AWS_REGION.
Why this isn't a configuration mistake
This was reproduced and isolated step by step, specifically to rule out "someone just left a field blank":
- The affected provider's
AWS_REGIONvalue was already marked "Saved" (non-empty) in the dashboard before any changes were made. - We explicitly set it to a known-valid value (
us-east-1) viaEdit Provider → AWS_REGIONand saved. The provider record'supdatedAttimestamp changed, confirming the write succeeded server-side. - The identical error reproduced immediately afterward, with the same model.
- We then added a second, structurally different model to the same provider — a plain single-region Bedrock model ID (no cross-region/"global." prefix) — and tested that instead. Same error, verbatim. This rules out any cross-region-inference-profile-specific parsing issue.
- We then inspected the desktop app's own Settings → Environment panel (
Save API keys and tokens for local agents, skills, and MCP servers. Secrets stay on this device.), and confirmed all four provider variables are present on-device with correct values, includingLPR_NCEED_AWS_REGIONshowing the exact value we'd just set.
So the region value: exists, is valid, is saved server-side, and is correctly delivered to and stored on the end-user device under its assigned name. It simply never reaches the SDK call that needs it under the name that call expects.
Root cause (source-level)
This BYOK feature stores each configured provider's secret material as a single combined blob and tells the client which namespaced environment variable names to read it under, to avoid collisions between multiple same-type providers in one org. For this provider, that is a LPR_<provider-id-suffix>_ prefix:
LPR_NCEED_AWS_ACCESS_KEY_ID
LPR_NCEED_AWS_SECRET_ACCESS_KEY
LPR_NCEED_AWS_REGION
LPR_NCEED_AWS_BEARER_TOKEN_BEDROCK
(The dashboard's own provider edit screen states this explicitly: "On members' machines and cloud workers this provider reads LPR_NCEED_AWS_ACCESS_KEY_ID, ..., LPR_NCEED_AWS_REGION, ..., so it never collides with a key someone set themselves or with another provider of the same kind.")
The actual model-execution engine that constructs the Bedrock client and runs the chat request is OpenCode (sst/opencode, vendored into this project as @opencode-ai/sdk / the bundled desktop runtime binary — a separate upstream project from this repository). Its Bedrock integration uses @ai-sdk/amazon-bedrock, whose settings loader only ever checks for an explicit region constructor option or the literal, unprefixed AWS_REGION environment variable. It has no knowledge of this project's LPR_<suffix>_ namespacing scheme.
Nothing in the glue between these two systems currently bridges the gap. Specifically:
-
ee/packages/utils/src/inference-credentials.ts'sinferenceCredentialEnvNames()function (the utility responsible for picking which single namespaced variable is "the" credential to forward for a provider) explicitly excludes any variable name containingREGIONby design:// ee/packages/utils/src/inference-credentials.ts:4-5 if (!/^[A-Z][A-Z0-9_]*$/.test(name) || /(?:^|_)(?:RESOURCE|PROJECT|LOCATION|REGION|ACCOUNT|TENANT|ENDPOINT|URL|SETTINGS|INPUT|OUTPUT)(?:_|$)/.test(name)) return []
This is correct and intentional for its stated purpose (
/** Only pass env names from the trusted catalog, never request bodies or stored custom config. */— it's a credential/secret selector, not a settings forwarder) — but it means region-like "settings" variables are a known, named category in this codebase's own design, and nothing else appears to perform the complementary job of forwarding that category under names the downstream AI SDK provider actually understands. -
The BYOK provider-creation route itself,
ee/apps/den-api/src/routes/org/llm-providers.ts, has no region/settings validation at all for this path. ItsnormalizeLlmProviderInput()(line 507) only special-cases@ai-sdk/amazon-bedrock/mantleto reject it outright (line 516: "... is available through AI Gateway, not Bring your own keys.") — it never calls anything equivalent to the region check below for the (non-Mantle)@ai-sdk/amazon-bedrockpath this bug affects. -
By contrast, the newer "AI Gateway" feature (a different, parallel credential-set system —
ee/apps/den-api/src/llm/gateway-matrix.ts) does this correctly:validateGatewaySettings()(line 28) callsbedrockSettingsError()(ee/apps/den-api/src/llm/inference-provider-config.ts:150), which explicitly requiresisAwsRegion(settings.region)(line 151: "Amazon Bedrock requires an AWS region code such as us-east-1.") before a Bedrock provider can even be saved. This confirms the project's own code already has a correct model for how Bedrock region handling should work — it just isn't wired through on the legacy BYOK path this bug affects, and even that correct gateway-side validation is about the save-time check, not the actual runtime SDK-settings bridging, which is the separate gap described above.
Version scope
Checked via direct tag comparison against different-ai/openwork (the upstream this project is published from): ee/apps/den-api/src/llm/gateway-matrix.ts, inference-provider-config.ts, and ee/packages/utils/src/inference-credentials.ts are unchanged between v0.18.42 and v0.18.54 (the version range covered by this deployment's recent upgrade). This is not a regression introduced by any version bump — it has been present at least since the "AI Gateway" / Bedrock support work landed (around v0.18.52-v0.18.54, commit feat(gateway): support Amazon Bedrock and Bedrock Mantle) and is still present in the latest release as of this writing.
Steps to reproduce
- As an org owner/admin, go to
Settings → AI Gateway → AI Providers → Legacy Providers → Add legacy provider. - Choose Amazon Bedrock (
@ai-sdk/amazon-bedrock, not the/mantlevariant) as a models.dev-sourced provider. - Supply valid values for all four declared env vars:
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_REGION(e.g.us-east-1),AWS_BEARER_TOKEN_BEDROCK. - Select any model from this provider's catalog — tested working with both a plain model ID (e.g.
anthropic.claude-<model>) and a cross-regionglobal.anthropic.claude-<model>ID; both fail identically. - Grant yourself access, save.
- In the OpenWork desktop app, start a new chat session, explicitly select a model from this provider, and send any prompt.
Expected: the request proceeds to the selected Bedrock model.
Actual: the request fails immediately with:
ProviderModelNotFoundError: Model not found: <llmProviderId>/<modelId>.
...
AWS region setting is missing. Pass it using the 'region' parameter or the AWS_REGION environment variable.
Confirmed present in Settings → Environment on the same device: LPR_<suffix>_AWS_REGION (correct, non-empty value) alongside the other three provider variables, all under the same LPR_<suffix>_ prefix.
Suggested fix direction
Somewhere in the boundary between this project's BYOK credential delivery and the OpenCode engine's provider construction, each declared "settings" env var for a provider (region for AWS; resourceName for Azure; project/location for Google Vertex — the same category inferenceCredentialEnvNames() already excludes from credential-forwarding) needs to also be resolved and either:
- re-exposed under the bare name the target AI SDK provider expects (e.g.
LPR_NCEED_AWS_REGION→AWS_REGIONin the process actually constructing the Bedrock client), or - passed explicitly as the relevant constructor option (
region: ...) when that provider client is instantiated.
Additionally, the BYOK (llm-providers.ts) save path should likely reuse bedrockSettingsError() / an equivalent settings validator — currently only the newer Gateway path enforces this at save time, so a BYOK Bedrock provider can be saved and silently fail at every single request instead of being rejected immediately with a clear message.
Where to file
This likely needs attention from both projects:
different-ai/openwork— owns theLPR_<suffix>_naming/forwarding scheme, the BYOK save-time validation gap, andinferenceCredentialEnvNames()'s settings/credential split.sst/opencode— owns the actual Bedrock provider construction andSessionPrompt.getModel/.runcode that ultimately needs the resolvedregion.
To Reproduce
- enroll AWS Bedrock (following documentation)
- assign it to people or teams
- as a user, try to use it ...
Expected behavior
as a user, one should be able to prompt / chat regardless of BYOK provider, Bedrock included
Actual behavior
every chat request against every model attached to that provider fails, regardless of which specific Bedrock model is selected (tested with both a plain, single-region model ID and a cross-region "global." inference-profile model ID — both failed identically), with:
ProviderModelNotFoundError: Model not found: <llmProviderId>/<modelId>.
...
AWS region setting is missing. Pass it using the 'region' parameter or the
AWS_REGION environment variable.
Screenshots (optional)
No response
OW version & Desktop info (optional)
No response
Additional context (optional)
NOTE:
AI / AWS-related secrets SHOULD NOT BE EXPOSED in client's user interface, regardless of user role!!!
(any user is allowed to see these keys' values clicking on the eye control... 100% safety elluded)
Activity
fix(den-api): pass BYOK provider settings to the AI SDK under scoped …
fix(den-api): pass BYOK provider settings to the AI SDK under scoped …
raul-gherman-modaoperandi commentedon Oct 7, 2026
I am sorry to report back that the issue is not fixed in 0.18.57:
raul-gherman-modaoperandi commentedon Oct 7, 2026
Den 0.18.57, desktop client on linux x86-64 (AppImage), same version