Skip to content

[BUG]:opencode run returns {UnknownError} when the configured default model is deprecated #46760

Closed as not planned

Description

@Drewlius

Description

opencode run returns an opaque server error when the configured default model becomes deprecated.

OpenCode documentation directs users to models.dev for built-in provider and model IDs. I selected x-preview-f-free from the OpenCode Zen provider page and configured it using the documented provider_id/model_id format:

"model": "opencode/x-preview-f-free"

This model worked previously. It is still displayed on the models.dev OpenCode Zen provider page with no visible deprecation warning, but its current API entry contains:

"status": "deprecated"

After the model became deprecated, opencode run began failing with:

Error: {
  "name": "UnknownError",
  "data": {
    "message": "Unexpected server error. Check server logs for details.",
    "ref": "err_1024fb4c"
  }
}

Expected behavior

OpenCode should validate the configured model against the refreshed catalog before creating the session.

If the model is deprecated or unavailable, the CLI should return a specific error such as:

Configured model opencode/x-preview-f-free is deprecated or unavailable. Select another model with opencode models.

It should not return an internal HTTP 500 or direct CLI users to unspecified server logs.

OpenCode should not silently select another model because that could unexpectedly use a paid model.

The models.dev OpenCode Zen provider page also displays this model without showing its deprecated status. Because OpenCode documentation directs users to models.dev for model IDs, provider pages should clearly label deprecated models. I placed the resulting model ID in ~/.config/opencode/opencode.jsonc.

Environment

Related issues

Plugins

Local oc-supermemory-redux (.js bundle), local WakaTime (.js bundle)

OpenCode version

1.18.25

Steps to reproduce

Reproduction

Add the following to ~/.config/opencode/opencode.jsonc:

{
  "$schema": "https://opencode.ai/config.json",
  "model": "opencode/x-preview-f-free"    \\or any deprecated model
}

Then run:

opencode models --refresh
opencode run "test"

CLI impact

I normally call opencode run through this Fish function:

function ? --wraps='opencode run' --description 'alias ?=opencode run'
    opencode run $argv
end

A previously working command such as this now fails:

? 'test'

The wrapper is not the cause. It directly passes its string arguments to opencode run. properly encapsulated in single quotations for fish shell compatibility.

This also affects scripts and other noninteractive uses of the CLI because the error does not identify the configured model as the problem.

Screenshot and/or share link

https://opncd.ai/share/fgqcdZ1l

Operating System

Garuda Linux x86_64 (Arch-based)

Terminal

Yakuake 26.08.0 with Fish 4.8.1

Activity

  1. github-actions commented on Sep 2, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of an existing issue. Please check:

  2. Drewlius commented on Sep 2, 2026

    @Drewlius
    Author

    This issue might be a duplicate of an existing issue. Please check:

    This is related to #46425, but the affected entrypoint and recovery path are different.

    #46425 occurs in the interactive TUI, where the user can switch models and continue the session. This issue affects the noninteractive opencode run command. The process exits immediately, returns control to the shell, and provides no actionable explanation.

    The available workarounds are to override the model on every invocation:

    opencode run --model provider/model "prompt"

    or edit the default model in opencode.jsonc.

    This affects shell functions, scripts, and automation using opencode run. A fix limited to model switching or error handling inside the TUI would not fix the CLI path. The CLI needs to validate the configured model and return a clear error before attempting the request.

  3. lancy69 commented on Sep 2, 2026

    @lancy69

    I'd like to work on this. My understanding is that the CLI should validate the configured default model against the refreshed catalog before creating the session, and return a specific "model is deprecated or unavailable" error instead of an opaque 500, without silently falling back to another model. Validation would be a repro with a deprecated model in opencode.jsonc plus tests for the new error path.

    One question first: should this be fixed alongside #46425 with a shared validation/error path, or is the noninteractive opencode run entrypoint enough for a first PR?

  4. Drewlius commented on Sep 6, 2026

    @Drewlius
    Author

    I would like the see the PR merged from @Woolgathererer if it is reviewed and approved by maintainers and compliance with anomalyco/opencode standards.

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

  6. Drewlius commented on Oct 11, 2026

    @Drewlius
    Author

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

    Yeah I did upgrade a week or so ago. Haven't seen this specific issue resurface but if I do I will make another report. Thanks for helping maintain this tool. I appreciate y'all's hard work and dedication to the project and FOSS in general.

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

Metadata

Metadata

Assignees

No one assigned

    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