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)
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
- 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 } } } } }
- Start while https://models.opencode.ai/api.json is unreachable/slow (block or throttle it).
- 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)
Source: anomalyco/opencode