You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
undefined: The provided model identifier is invalid #11037
ERROR 2026-01-28T19:10:26 +7ms service=session.processor error=undefined: The provided model identifier is invalid. stack="AI_APICallError: undefined: The provided model identifier is invalid.\n at (../../node_modules/.bun/@ai-sdk[email protected]+d6123d32214422cb/node_modules/@ai-sdk/provider-utils/dist/index.mjs:936:18)\n at processTicksAndRejections (native:7:39)" process
I think I figured out the issue. deepseek.v3-v1 is an on-demand model (unlike R1) - so it should not have the us. prefix when calling the api. For context, this is on opencode tag v1.1.42. packages/opencode/src/provider/provider.ts:311, I commented out "deepseek" in the modelRequiresPrefix array, then re-built opencode and deepseek.v3-v1 worked perfectly.
Hope this helps.
I also just started encountering this behavior today. every Anthropic model we have access to via our corporate AWS is flagged as invalid in opencode.
macOS Sequoia 15.6.1
opencode 1.1.50, installed via homebrew
This behavior was not present yesterday (2026-02-03); I did not manually upgrade before encountering, and upgrading from 1.1.30 -> 1.1.50 did not change behavior.
Full log output on a failed prompt:
$ AWS_PROFILE=default opencode --print-logs
INFO 2026-02-04T13:06:24 +242ms service=default version=1.1.50 args=["--print-logs"] opencode
INFO 2026-02-04T13:06:24 +1ms service=config path=/Users/nshreve/.config/opencode/config.json loading
INFO 2026-02-04T13:06:24 +0ms service=config path=/Users/nshreve/.config/opencode/opencode.json loading
INFO 2026-02-04T13:06:24 +1ms service=config path=/Users/nshreve/.config/opencode/opencode.jsonc loading
█▀▀█ New session - 2026-02-04T13:06:31.922Z
█ █ opencode -s ses_3d73d088dffeW8hv7UBg3aMQ84
▀▀▀▀
# New session - 2026-02-04T13:24:35.018Z
test
undefined: The provided model identifier is invalid.
▣ Build · us.anthropic.claude-sonnet-4-5-20250929-v1:0
I know my model identifiers are valid as far as AWS is concerned:
$ aws bedrock-runtime invoke-model \
--model-id us.anthropic.claude-sonnet-4-5-20250929-v1:0 \
--body '{"anthropic_version": "bedrock-2023-05-31","messages":[{"role":"user","content":"Tell me a joke."}],"max_tokens":200}' \
--cli-binary-format raw-in-base64-out \
/dev/stdout | jq -r '.content[]?.text?'
Why don't scientists trust atoms?Because they make up everything!
Thanks for the detailed debug info @neshreve! You correctly identified the issue - the us.us. in the URL shows the region prefix was being added twice.
Good news: This was already fixed in v1.1.51 (commit b942e0b - "fix: prevent double-prefixing of Bedrock cross-region inference models").
The fix adds us., eu., jp., apac., and au. to the list of cross-region prefixes that are checked before adding a region prefix. If the model ID already starts with one of these prefixes, it skips adding another one.
Resolution: Update to v1.1.51 or later and the issue should be resolved. You can update with:
npm install -g opencode-ai@latest
# or
bun install -g opencode-ai@latest
Let us know if you still experience issues after updating!
for what it's worth, npm install failed with the below error, but brew install anomalyco/tap/opencode got me where I needed to be.
very much appreciate your swift responses <3
$ npm install -g opencode@latest
npm error code E404
npm error 404 Not Found - GET https://registry.npmjs.org/opencode@latest - Not found
npm error 404
npm error 404 The requested resource 'opencode@latest' could not be found or you do not have permission to access it.
...
Activity
github-actions commentedon Jan 28, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if your specific case involves different model configurations.
cravenceiling commentedon Jan 28, 2026
Those models are probably not in the models.dev database.
https://models.dev/?search=bedrock
LeeWong commentedon Jan 28, 2026
They are in model.dev database:
qwen.qwen3-coder-480b-a35b-v1:0
deepseek.v3-v1:0
cravenceiling commentedon Jan 28, 2026
What is the output when you run with
opencode --print-logs?LeeWong commentedon Jan 28, 2026
undefined: The provided model identifier is invalid.
LeeWong commentedon Jan 28, 2026
from the log file:
ERROR 2026-01-28T19:10:26 +7ms service=session.processor error=undefined: The provided model identifier is invalid. stack="AI_APICallError: undefined: The provided model identifier is invalid.\n at (../../node_modules/.bun/@ai-sdk[email protected]+d6123d32214422cb/node_modules/@ai-sdk/provider-utils/dist/index.mjs:936:18)\n at processTicksAndRejections (native:7:39)" process
Solidsilver commentedon Jan 29, 2026
I'm getting the same error - at least with DeepSeek v3.1 on Amazon Bedrock. The region is set to
us-west-2in my opencode configHere is a truncated version of the logs I'm seeing:
Solidsilver commentedon Jan 29, 2026
I think I figured out the issue. deepseek.v3-v1 is an on-demand model (unlike R1) - so it should not have the
us.prefix when calling the api. For context, this is on opencode tagv1.1.42.packages/opencode/src/provider/provider.ts:311, I commented out "deepseek" in themodelRequiresPrefixarray, then re-built opencode and deepseek.v3-v1 worked perfectly.Hope this helps.
rekram1-node commentedon Jan 29, 2026
Thx @Solidsilver will look
neshreve commentedon Feb 4, 2026
I also just started encountering this behavior today. every Anthropic model we have access to via our corporate AWS is flagged as invalid in opencode.
macOS Sequoia 15.6.1
opencode 1.1.50, installed via homebrew
This behavior was not present yesterday (2026-02-03); I did not manually upgrade before encountering, and upgrading from 1.1.30 -> 1.1.50 did not change behavior.
Full log output on a failed prompt:
$ AWS_PROFILE=default opencode --print-logs INFO 2026-02-04T13:06:24 +242ms service=default version=1.1.50 args=["--print-logs"] opencode INFO 2026-02-04T13:06:24 +1ms service=config path=/Users/nshreve/.config/opencode/config.json loading INFO 2026-02-04T13:06:24 +0ms service=config path=/Users/nshreve/.config/opencode/opencode.json loading INFO 2026-02-04T13:06:24 +1ms service=config path=/Users/nshreve/.config/opencode/opencode.jsonc loading █▀▀█ New session - 2026-02-04T13:06:31.922Z █ █ opencode -s ses_3d73d088dffeW8hv7UBg3aMQ84 ▀▀▀▀R44VC0RP commentedon Feb 4, 2026
@neshreve where did you see the message showing it as invalid?
was that in the session?
neshreve commentedon Feb 4, 2026
@R44VC0RP yes, my conversations look like this:
I know my model identifiers are valid as far as AWS is concerned:
$ aws bedrock-runtime invoke-model \ --model-id us.anthropic.claude-sonnet-4-5-20250929-v1:0 \ --body '{"anthropic_version": "bedrock-2023-05-31","messages":[{"role":"user","content":"Tell me a joke."}],"max_tokens":200}' \ --cli-binary-format raw-in-base64-out \ /dev/stdout | jq -r '.content[]?.text?' Why don't scientists trust atoms? Because they make up everything!R44VC0RP commentedon Feb 4, 2026
can you run
opencode export > session.jsonafter you open a new session in TUI and try again, want to see if it can provide any other informationneshreve commentedon Feb 4, 2026
absolutely, does the session have to be open at the time of export or is the workflow
open oc -> failed prompt -> close oc -> export?R44VC0RP commentedon Feb 4, 2026
nah, you can
opencodeopencode export >session.jsonneshreve commentedon Feb 4, 2026
ready for profit
{ "info": { "id": "ses_3d72c81b5ffeNjisPvsJ7jNjcE", "slug": "mighty-planet", "version": "1.1.50", "projectID": "64266c7adf47bf10de2a7a4974d6497447962c15", "directory": "/Users/nshreve/.dotfiles/opencode", "title": "New session - 2026-02-04T13:24:35.018Z", "time": { "created": 1770211475018, "updated": 1770212290712 }, "summary": { "additions": 0, "deletions": 0, "files": 0 } }, "messages": [ { "info": { "id": "msg_c28d37e51001Gpipk7y2FmZ5Dd", "sessionID": "ses_3d72c81b5ffeNjisPvsJ7jNjcE", "role": "user", "time": { "created": 1770211475037 }, "summary": { "diffs": [] }, "agent": "build", "model": { "providerID": "amazon-bedrock", "modelID": "us.anthropic.claude-sonnet-4-5-20250929-v1:0" } }, "parts": [ { "id": "prt_c28d37e52001nersXvPHuuuIEl", "sessionID": "ses_3d72c81b5ffeNjisPvsJ7jNjcE", "messageID": "msg_c28d37e51001Gpipk7y2FmZ5Dd", "type": "text", "text": "test" } ] }, { "info": { "id": "msg_c28d37e6d001glVV7Xe8TtHM05", "sessionID": "ses_3d72c81b5ffeNjisPvsJ7jNjcE", "role": "assistant", "time": { "created": 1770211475053, "completed": 1770211477048 }, "error": { "name": "APIError", "data": { "message": "undefined: The provided model identifier is invalid.", "statusCode": 400, "isRetryable": false, "responseHeaders": { "connection": "keep-alive", "content-length": "55", "content-type": "application/json", "date": "Wed, 04 Feb 2026 13:24:37 GMT", "x-amzn-errortype": "ValidationException:http://internal.amazon.com/coral/com.amazon.bedrock/", "x-amzn-requestid": "42ef7a7e-9172-4f8f-8629-8732ffccb1cd" }, "responseBody": "{\"message\":\"The provided model identifier is invalid.\"}", "metadata": { "url": "https://bedrock-runtime.us-east-1.amazonaws.com/model/us.us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/converse-stream" } } }, "parentID": "msg_c28d37e51001Gpipk7y2FmZ5Dd", "modelID": "us.anthropic.claude-sonnet-4-5-20250929-v1:0", "providerID": "amazon-bedrock", "mode": "build", "agent": "build", "path": { "cwd": "/Users/nshreve/.dotfiles/opencode", "root": "/Users/nshreve/.dotfiles" }, "cost": 0, "tokens": { "input": 0, "output": 0, "reasoning": 0, "cache": { "read": 0, "write": 0 } } }, "parts": [] }, { "info": { "id": "msg_c28dff014001AXWA6OICj5xUXK", "sessionID": "ses_3d72c81b5ffeNjisPvsJ7jNjcE", "role": "user", "time": { "created": 1770212290599 }, "summary": { "diffs": [] }, "agent": "build", "model": { "providerID": "amazon-bedrock", "modelID": "us.anthropic.claude-sonnet-4-5-20250929-v1:0" } }, "parts": [ { "id": "prt_c28dff014002U1Av1R32QeGQDw", "sessionID": "ses_3d72c81b5ffeNjisPvsJ7jNjcE", "messageID": "msg_c28dff014001AXWA6OICj5xUXK", "type": "text", "text": "test" } ] }, { "info": { "id": "msg_c28dff03d001MSfboHggUnGyu4", "sessionID": "ses_3d72c81b5ffeNjisPvsJ7jNjcE", "role": "assistant", "time": { "created": 1770212290621, "completed": 1770212292627 }, "error": { "name": "APIError", "data": { "message": "undefined: The provided model identifier is invalid.", "statusCode": 400, "isRetryable": false, "responseHeaders": { "connection": "keep-alive", "content-length": "55", "content-type": "application/json", "date": "Wed, 04 Feb 2026 13:38:12 GMT", "x-amzn-errortype": "ValidationException:http://internal.amazon.com/coral/com.amazon.bedrock/", "x-amzn-requestid": "664fb90d-9188-4628-8d4b-e4d39ade3a8d" }, "responseBody": "{\"message\":\"The provided model identifier is invalid.\"}", "metadata": { "url": "https://bedrock-runtime.us-east-1.amazonaws.com/model/us.us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/converse-stream" } } }, "parentID": "msg_c28dff014001AXWA6OICj5xUXK", "modelID": "us.anthropic.claude-sonnet-4-5-20250929-v1:0", "providerID": "amazon-bedrock", "mode": "build", "agent": "build", "path": { "cwd": "/Users/nshreve/.dotfiles/opencode", "root": "/Users/nshreve/.dotfiles" }, "cost": 0, "tokens": { "input": 0, "output": 0, "reasoning": 0, "cache": { "read": 0, "write": 0 } } }, "parts": [] } ] }neshreve commentedon Feb 4, 2026
@R44VC0RP this is probably related, in the metadata of the error, the model designation in the url has
us.us.at the beginningR44VC0RP commentedon Feb 4, 2026
Yeah saw that, investigating now
R44VC0RP commentedon Feb 4, 2026
Thanks for the detailed debug info @neshreve! You correctly identified the issue - the
us.us.in the URL shows the region prefix was being added twice.Good news: This was already fixed in v1.1.51 (commit b942e0b - "fix: prevent double-prefixing of Bedrock cross-region inference models").
The fix adds
us.,eu.,jp.,apac., andau.to the list of cross-region prefixes that are checked before adding a region prefix. If the model ID already starts with one of these prefixes, it skips adding another one.Resolution: Update to v1.1.51 or later and the issue should be resolved. You can update with:
npm install -g opencode-ai@latest # or bun install -g opencode-ai@latestLet us know if you still experience issues after updating!
neshreve commentedon Feb 4, 2026
thank you so much for your help @R44VC0RP!
for what it's worth, npm install failed with the below error, but
brew install anomalyco/tap/opencodegot me where I needed to be.very much appreciate your swift responses <3
R44VC0RP commentedon Feb 4, 2026
That was a typo on my end, our npm namespace is
opencode-aiigor-elbert commentedon Feb 5, 2026
@R44VC0RP, I'm getting the same error in v1.1.51 with any model. I'm in EU AWS region.
session.json