anomalyco / anomalyco/opencode
ProviderModelNotFoundError suggests the identical model string; multi-segment model keys fail as opaque "Unexpected server error"
Open
@neriousy is already working on this.
Since Sep 12, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
When a custom OpenAI-compatible provider defines model keys that themselves contain a slash (e.g. NVIDIA NIM: nvidia/nemotron-3.5-lightning-30b-a3b), opencode run -m <model-key> without the provider prefix fails in two unhelpful ways:
- Without
--print-logs, the CLI prints onlyUnexpected server error— nothing in the normal logs points at the cause (the log line ends atllm runtime selected). - With
--print-logs, the underlying error is self-contradictory:
ProviderModelNotFoundError: Model not found: nvidia/nemotron-3.5-lightning-30b-a3b. Did you mean: nvidia/nemotron-3.5-lightning-30b-a3b?
The "not found" model and the suggestion are the identical string, so the message offers no actionable hint. The actual fix is to pass the provider namespace explicitly (nim/nvidia/nemotron-3.5-lightning-30b-a3b), which the error never suggests.
Expected
-m <multi-segment-model-key>should either resolve, or fail with a clear message like "model key is ambiguous — prefix the provider:<provider>/<key>".- The "Did you mean" suggestion should not repeat the exact unmatched string.
- A model-resolution failure should not surface to the user as a generic
Unexpected server error.
Steps to reproduce
~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"nim": {
"npm": "@ai-sdk/openai-compatible",
"options": { "baseURL": "https://integrate.api.nvidia.com/v1", "apiKey": "{env:EXAMPLE_KEY}" },
"models": { "nvidia/nemotron-3.5-lightning-30b-a3b": { "name": "Nemotron 3.5 Lightning 30B" } }
}
}
}
opencode run -m nvidia/nemotron-3.5-lightning-30b-a3b "Reply OK"→Unexpected server erroropencode run --print-logs -m nvidia/nemotron-3.5-lightning-30b-a3b "Reply OK"→ProviderModelNotFoundError: Model not found: nvidia/nemotron-3.5-lightning-30b-a3b. Did you mean: nvidia/nemotron-3.5-lightning-30b-a3b?opencode run -m nim/nvidia/nemotron-3.5-lightning-30b-a3b "Reply OK"→ works
Environment
- OpenCode 1.18.30 (
opencode-ainpm package), Windows 11 (build 10.0.26200) - Provider npm:
@ai-sdk/openai-compatible; provider id:nim - Possibly related: #39926 (
parseModelsplitting), #47690 (double-prefixing of model IDs)
Plugins: none in use.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.