You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
core: "Failed to fetch models.dev" reports no cause and no next step #56742
Title:core: "Failed to fetch models.dev" reports no cause and no next step
Template: Bug report
Description
When the periodic models.dev refresh fails, packages/core/src/models-dev.ts:429 logs the symptom
and nothing else:
timestamp=2026-09-21T13:45:53.227Z level=ERROR run=<redacted> message="Failed to fetch models.dev" cause="Cause([Fail(HttpClientError: Transport error (GET https://models.opencode.ai/api.json) (cause: Error: Unable to connect. Is the computer able to access the url?))])"
Two unrelated causes land under this one message: a transport failure, and an EACCES when the
refresh cannot create ~/.local/state/opencode/locks. Neither says what to do, and neither says
whether the running session is affected — it isn't, because the bundled snapshot is the boot floor.
On my machine this is 56 of 790 ERROR lines (7.1%), making it the most frequent non-provider
failure I hit. It clusters hard — 15 occurrences on one day — because refresh() repeats on a 5
minute TTL and every retry re-logs the identical opaque line.
Suggested: classify the cause and log the host plus a next action, e.g.
Cannot reach models.opencode.ai (connection refused). Using the bundled model catalog; retrying
in 5 minutes. Check HTTP_PROXY/HTTPS_PROXY if you expect a proxy.
networkFailure() in packages/core/src/aisdk.ts:977 already classifies these shapes
(ECONNREFUSED, ETIMEDOUT, "fetch failed", UND_ERR*), but it is private to that module and
used only for LLM errors. Extracting it into a shared module would let both call sites use it.
This is one instance of the wider problem in #35325 and #36582 — I'm filing it narrowly rather than
duplicating those.
Plugins
None.
OpenCode version
v2, built from v2-patched (reports 1.18.31; the version string is stale on this fork).
Steps to reproduce
Break outbound network, or point the machine at a host that refuses connections.
Start opencode and leave it running.
Read ~/.local/share/opencode/log/opencode.log, grep for Failed to fetch models.dev.
Observe the same line repeated every 5 minutes with no cause or remedy.
Thanks for the detailed report and the numbers from your logs. To restate the request: when the periodic models.dev refresh fails, the log should say which failure it was (network/transport vs. a filesystem error such as EACCES on ~/.local/state/opencode/locks), name the host and point to a next step (proxy settings, permissions). It should also say that the bundled catalog is still in use and when the next retry is, instead of repeating the same raw Cause(...) line every 5 minutes. Reusing the networkFailure() classifier from packages/core/src/aisdk.ts for this makes sense.
I checked dev, and packages/core/src/models-dev.ts still logs only Failed to fetch models.dev with the raw cause, so this applies to current v2. Maintainers will consider it.
Activity
opencode-agent commentedon Oct 18, 2026
Thanks for the detailed report and the numbers from your logs. To restate the request: when the periodic models.dev refresh fails, the log should say which failure it was (network/transport vs. a filesystem error such as
EACCESon~/.local/state/opencode/locks), name the host and point to a next step (proxy settings, permissions). It should also say that the bundled catalog is still in use and when the next retry is, instead of repeating the same rawCause(...)line every 5 minutes. Reusing thenetworkFailure()classifier frompackages/core/src/aisdk.tsfor this makes sense.I checked
dev, andpackages/core/src/models-dev.tsstill logs onlyFailed to fetch models.devwith the raw cause, so this applies to current v2. Maintainers will consider it.Related issues:
Unable to connect. Is the computer able to access the url?(closed)