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
opencode run exits with "unexpected server error" #33766
When running opencode run $message I get an unexpected server error similar to this:
Error: {
"name": "UnknownError",
"data": {
"message": "Unexpected server error. Check server logs for details.",
"ref": "err_c7bc0eda"
}
}
after this ~/.local/share/opencode/log/opencode.log is created but it's empty.
Experienced with a local model running llama.cpp. llama.cpp logs show no requests received.
Looks like this was caused by a configuration error on my side, the model field in the configuration json was set to a model that was not defined under the provider section.
Reacted by Russell Sammut-Bonnici and Baptiste Gaillard
@rekram1-node the initial issue is resolved, but I'd like to leave this open to request better logging support and better error messages, so that the log file is not empty when we get an error like this.
Another trigger for this opaque error: system load, with a valid config
Adding a data point since the visible causes so far have been config typos (undefined model refs). We hit the identical UnknownError / empty-log symptom with a fully valid, resolvable config — it's intermittent and correlates with system load, not a static misconfiguration:
opencode run -m litellm/gpt-4o-mini --agent <agent> --format json "<task>" → rc=1 in ~2s, 0 tool calls, stdout is a single {"type":"error",...,"UnknownError",...,"ref":"err_XXXXXXXX"}.
Reproduced identically across gpt-4o-mini, gpt-5, and deepseek-v4-pro (two providers) — all defined and independently confirmed working via direct API calls. So it's pre-model (model=undefined in the log; the throw is in SessionPrompt.createUserMessage, before any provider/model contact).
Load-correlated: on a loaded machine it fails ~10/10; idle, runs succeed. Same binary, same config, same prompt — only system load differs.
ref is a per-occurrence random id (four consecutive: err_2c8fee34 / err_87117e7d / err_9eddd56c / err_ab6dad40), so it's not a lookup code.
Strong +1 to @jjdredd's ask: because the error is double-wrapped as UnknownError: UnknownError and the cause is discarded (empty opencode.log), very different root causes — config typos AND this load-triggered createUserMessage failure — are indistinguishable to users. Surfacing the underlying error/stack (even at DEBUG) would let people self-diagnose instead of filing dupes. opencode 1.17.15.
Hi, I also encountered the same error with the following command.
$ opencode run "Explain how closures work in JavaScript"
Error: {
"name": "UnknownError",
"data": {
"message": "Unexpected server error. Check server logs for details.",
"ref": "err_729e1969"
}
}
As @jjdredd I succeeded to fix it, but, in my case the jsonc configuration file was totally valid, even for the models.
I fixed it by specifying a valid model with the --model option on the CLI, for exemple the following calls work.
# Using a model from the 'scaleway' provider
$ opencode run --model "scaleway/qwen3.5-397b-a17b""Explain how closures work in JavaScript"# Using a model from the 'mistral' provider
$ opencode run --model "mistral-medium-latest""Explain how closures work in JavaScript"
I agree that this errors seems to be an error which occurs during an failed model selection, the message could be more clear.
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.
Activity
RussellSB commentedon Jun 25, 2026
Im getting the same issue when trying to trigger a command from GitHub Actions
jjdredd commentedon Jun 27, 2026
Looks like this was caused by a configuration error on my side, the
modelfield in the configuration json was set to a model that was not defined under the provider section.jjdredd commentedon Jun 27, 2026
It would be nice to have readable error messages and have the error logging enabled, so that the logs aren't empty in such events.
RussellSB commentedon Jun 27, 2026
Can confirm the same 😅 'deepseek-v4-flash' instead of 'deepseek-flash-v4' .
Totally agree. Should be a pretty straight forward error to catch up on and communicate.
jjdredd commentedon Jun 27, 2026
@rekram1-node the initial issue is resolved, but I'd like to leave this open to request better logging support and better error messages, so that the log file is not empty when we get an error like this.
franzn commentedon Jul 11, 2026
Another trigger for this opaque error: system load, with a valid config
Adding a data point since the visible causes so far have been config typos (undefined model refs). We hit the identical
UnknownError/ empty-log symptom with a fully valid, resolvable config — it's intermittent and correlates with system load, not a static misconfiguration:opencode run -m litellm/gpt-4o-mini --agent <agent> --format json "<task>"→ rc=1 in ~2s, 0 tool calls, stdout is a single{"type":"error",...,"UnknownError",...,"ref":"err_XXXXXXXX"}.gpt-4o-mini,gpt-5, anddeepseek-v4-pro(two providers) — all defined and independently confirmed working via direct API calls. So it's pre-model (model=undefinedin the log; the throw is inSessionPrompt.createUserMessage, before any provider/model contact).refis a per-occurrence random id (four consecutive:err_2c8fee34 / err_87117e7d / err_9eddd56c / err_ab6dad40), so it's not a lookup code.Strong +1 to @jjdredd's ask: because the error is double-wrapped as
UnknownError: UnknownErrorand the cause is discarded (emptyopencode.log), very different root causes — config typos AND this load-triggeredcreateUserMessagefailure — are indistinguishable to users. Surfacing the underlying error/stack (even at DEBUG) would let people self-diagnose instead of filing dupes. opencode 1.17.15.bgaillard commentedon Aug 22, 2026
Hi, I also encountered the same error with the following command.
As @jjdredd I succeeded to fix it, but, in my case the jsonc configuration file was totally valid, even for the models.
I fixed it by specifying a valid model with the
--modeloption on the CLI, for exemple the following calls work.I agree that this errors seems to be an error which occurs during an failed model selection, the message could be more clear.
Hope this helps.
Baptiste
thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊