anomalyco / anomalyco/opencode

v2: config-declared custom-provider models silently become 0 in catalog when models.opencode.ai fetch fails at boot (provider survives, resolution-by-ID still works)

Open
#41,360 1 comment 0 reactions 1 assignee View on GitHub

@rekram1-node is already working on this.

Since Aug 9, 2026.

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

Description

Description

Custom providers declared entirely in config (provider. with an inline models map, using model IDs not in the public models.opencode.ai catalog) end up with 0 models and disappear from the picker — with no error shown. The provider entry survives; only its models are dropped.

Cause: the boot fetch of https://models.opencode.ai/api.json is swallowed on failure (logError "Failed to fetch models.dev" then Effect.ignore), and custom-model hydration then produces an empty models map instead of keeping the config-declared models. The empty catalog persists until the server rebuilds during a successful fetch.

Model resolution by explicit ID keeps working the whole time (run -m / succeeds), so only the catalog/listing path breaks, not resolution. Typing the model name into the picker search box returns nothing, confirming the catalog is genuinely empty rather than filtered.

Related but not duplicate: #35090, #35713, #32986, #34730 describe loud errors/crashes from the models.dev fetch; this is silent, persistent loss of config-declared custom models while the app looks healthy.

Expected: config-declared models should register and list regardless of the models.opencode.ai fetch; a failed fetch should degrade gracefully (warn + keep declared models), not zero them out.

Plugins

none required to reproduce (also repro'd with plugins disabled)

OpenCode version

Desktop beta 0.0.0-beta-202608090143; CLI opencode2 0.0.0-next-15820

Steps to reproduce
  1. Add a custom provider in opencode.json with model IDs not in models.opencode.ai:
    "provider": { "myproxy": { "npm": "@ai-sdk/openai-compatible", "name": "My Proxy",
    "options": { "baseURL": "{env:MY_BASE_URL}", "apiKey": "{env:MY_TOKEN}" },
    "models": { "some/private-model-id": { "name": "Private Model", "tool_call": true,
    "limit": { "context": 200000, "output": 64000 } } } } }
  2. Start while https://models.opencode.ai/api.json is unreachable/slow (block or throttle it).
  3. Open the picker (or GET /api/model).

Result: picker empty; model name absent even when typed in search; GET /api/model -> {"data":[]}; GET /api/provider shows the provider with 0 models; no UI error; persists across relaunches until the catalog rebuilds during a good fetch.
Verified: same config + reachable fetch + fresh server start -> full catalog lists all declared models.

Screenshot and/or share link

No response

Operating System

macOS 26.6.1 (arm64)

Terminal

OpenCode Beta desktop app (also repro'd via opencode2 CLI)

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.