Skip to content

opencode run exits with "unexpected server error" #33766

Closed as not planned
Closed as not planned

Description

@jjdredd

Description

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.

Plugins

No response

OpenCode version

1.17.10

Steps to reproduce

  1. opencode run "hello"
  2. observe error.

Screenshot and/or share link

No response

Operating System

Gentoo Linux amd64

Terminal

kitty

Activity

  1. RussellSB commented on Jun 25, 2026

    @RussellSB

    Im getting the same issue when trying to trigger a command from GitHub Actions

  2. jjdredd commented on Jun 27, 2026

    @jjdredd
    Author

    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.

  3. jjdredd commented on Jun 27, 2026

    @jjdredd
    Author

    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.

  4. RussellSB commented on Jun 27, 2026

    @RussellSB

    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.

  5. jjdredd commented on Jun 27, 2026

    @jjdredd
    Author

    @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.

  6. franzn commented on Jul 11, 2026

    @franzn

    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.

  7. bgaillard commented on Aug 22, 2026

    @bgaillard

    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.

    Hope this helps.

    Baptiste

  8. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    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 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions