anomalyco / anomalyco/opencode

ProviderModelNotFoundError suggests the identical model string; multi-segment model keys fail as opaque "Unexpected server error"

Open
#48,721 1 comment 0 reactions 1 assignee View on GitHub

@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:

  1. Without --print-logs, the CLI prints only Unexpected server error — nothing in the normal logs points at the cause (the log line ends at llm runtime selected).
  2. 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
  1. ~/.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" } }
    }
  }
}
  1. opencode run -m nvidia/nemotron-3.5-lightning-30b-a3b "Reply OK"Unexpected server error
  2. opencode 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?
  3. opencode run -m nim/nvidia/nemotron-3.5-lightning-30b-a3b "Reply OK" → works
Environment
  • OpenCode 1.18.30 (opencode-ai npm package), Windows 11 (build 10.0.26200)
  • Provider npm: @ai-sdk/openai-compatible; provider id: nim
  • Possibly related: #39926 (parseModel splitting), #47690 (double-prefixing of model IDs)

Plugins: none in use.

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.