Repository navigation
core: all models.dev providers disappear when the catalog fetch fails #57458
Copy link
Copy link
Open
Description
Summary
When the models.dev catalog fetch fails, OpenCode ends up with an empty provider registry: every catalog provider disappears — including github-copilot, even though its credential is valid and the Copilot API answers HTTP 200 in 0.65s. Only the providers advertised by the OpenCode Console config (opencode-go) survive, because they are registered through a different code path.
GitHub Copilot has a second, independent gate: its plugin registers the provider only if the model sync succeeded, and that sync has a hard-coded 5s timeout. One timeout removes the provider, and nothing ever retries it.
Environment
- opencode version: 2.1.1
- OS: Ubuntu, Linux x64
- Terminal: xterm-256color, COLORTERM=truecolor
- Shell: /bin/bash
- Install/channel: latest
- Active plugins: none provider-related (local guardrail plugins and MCP servers only; none of them touch the provider layer)
Reproduction
Deterministic repro that does not involve GitHub Copilot at all:
- Start a server with the network to
models.opencode.aiblocked:HTTPS_PROXY=http://127.0.0.1:9 HTTP_PROXY=http://127.0.0.1:9 opencode serve --port 46003 opencode api --server http://127.0.0.1:46003 provider.list→{"data":[]}— zero providers, even though the local catalog cache holds 231 providers.- Unblock the network, restart, run the same command → the providers are back.
On the normal (networked) install:
ANTHROPIC_API_KEY=dummy opencode models | grep -c '^anthropic/'→0GITHUB_TOKEN=dummy opencode models | grep -c '^github-copilot/'→0opencode models | grep -c '^opencode-go/'→29— only the console-provided provider survives.
Copilot-specific path:
opencode auth login github-copilot(device code) → credential stored,active: truecurl -sS -m 10 -H "Authorization: Bearer $TOKEN" https://api.individual.githubcopilot.com/models→HTTP 200in 0.65sopencode models | grep -c '^github-copilot/'→0- server log:
WARN ... "failed to sync GitHub Copilot models" cause="TimeoutError: The operation timed out."
Expected Behavior
- A failed models.dev fetch should not empty the provider registry: the cached catalog should be used, or the previously loaded registry should be kept.
- A provider whose credential is valid should stay registered even when the model sync fails, and the sync should be retried.
Actual Behavior
- The provider registry is populated from a live fetch of
https://models.opencode.ai/api.json. The cache written by the same service (models-dev:catalogin thekvtable, 231 providers, freshly written) did not seed the registry, so a failed fetch leaves zero providers. - The GitHub Copilot plugin only registers the provider on sync success:
and it also bails out earlier with
if (l.models) { h.add({ info: S.provider, models: ..., sourceConnection: l.connection }); return } for (let F of S.models.keys()) h.models.update(...) // else: rewrites packages, never adds the provider
if (!S) returnwhengithub-copilotis not already in the registry. - The sync uses
AbortSignal.timeout(5000). The endpoint answers in 0.65s via curl, but the log shows the timeout. - The plugin re-syncs only on
integration.Switched(new login / credential switch) or server start.opencode api POST /api/location/reloaddoes not re-trigger it, so the state is sticky. - Provider availability is non-deterministic: a freshly started server first listed
github-copilot, anthropic, opencode, and a few minutes later the same server listed onlyopencode-go.
Additional Context
Failed to fetch models.devappears 42 times in~/.local/share/opencode/log/opencode.logbetween 2026-09-30 and now, withgetaddrinfo ETIMEOUT models.opencode.aiandTimeoutError: Operation timed out after '10s'. The refresh runs every 5 minutes.failed to sync GitHub Copilot modelsappears 6 times in the same log.opencode.provider.opencodeis unaffected because it takes its providers from the Console config (GET /api/v2/config→providers.opencode-go), not from models.dev.- Please see OpenAI models disappear when OpenCode Zen or Go is connected #52363 (already suspects that models.dev records never reach provider state), Github Copilot models disappear when a Go/Zen API key is also stored #55082 (same symptom with a Go/Zen credential stored) and GitHub Copilot model sync times out on 2.0.32 (manual API works) #57264 (the Copilot sync timeout).
- No workaround found: Github Copilot models disappear when a Go/Zen API key is also stored #55082 suggests deleting the console credential rows from the DB, which just trades one provider for another.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
opencode-agent commentedon Oct 20, 2026
Thanks for the detailed report. I tried to reproduce this on 2.1.1 (Linux, clean profile, no plugins) but couldn't get providers to disappear for good:
Operation timed out after '10s'as your log):provider.listwas empty only for the first few seconds afteropencode servestarted, while the first catalog fetch was pending. After the fetch failed it listedanthropicandopencodefrom the built-in catalog. They were still listed about 6 minutes later, after the 5-minute refresh had failed again. With themodels-dev:catalogcache already written, providers showed up after about 4s.ANTHROPIC_API_KEY=dummy opencode modelslisted 20anthropic/models, not 0.failed to sync GitHub Copilot models ... TimeoutError, butopencode modelsstill listed 38github-copilot/models. When the sync fails, the plugin falls back to the catalog's Copilot models instead of removing the provider.So the only part I could confirm is a short empty provider list right after startup. That looks like the startup race discussed in #41360. Since you have OpenCode Console / Go credentials stored, the providers going missing for good (and
opencode modelsshowing onlyopencode-go) fits better with #52363 / #55082.It would help to know:
provider.liststay empty if you wait 30–60s after starting the blocked server, or only right after start?opencode/opencode-gocredentials stored (e.g. temporaryXDG_DATA_HOME/XDG_CONFIG_HOME)?Related issues: