Skip to content

[bug] --model is silently ignored on the default (TUI) entry path: an unresolvable id runs the configured default model with no warning #47172

Closed as not planned

Description

@schickling-assistant

Description

--model is validated on the opencode run path but silently discarded on the default (TUI) entry
path. opencode --model <unresolvable-id> --prompt ... creates the session on the configured
default
model and provider, completes the turn normally, and never mentions the requested id — no
warning, no error, no failure.

Both observables report the substitute as though it had been requested: the session record logs
model.id=<default> and the TUI footer shows the default model. Nothing anywhere records what was
asked for. Automation that pins a model on the command line therefore cannot determine which model
actually ran, and cannot detect that a pin stopped being honoured.

Plugins

None — reproduced with --pure and an empty XDG_CONFIG_HOME.

OpenCode version

1.18.27. Also reproduced on 1.18.26 and 1.18.25.

Operating System

NixOS, Linux 6.18 x86_64

Terminal

xterm-256color, run non-interactively inside a PTY

Steps to reproduce

Same unresolvable model id, two entry paths.

1. Scratch project:

mkdir -p /tmp/oc-repro && cd /tmp/oc-repro && git init -q

2. run path — behaves correctly:

cd /tmp/oc-repro && opencode run --pure --print-logs --log-level INFO \
  --model opencode/totally-bogus-model-zzz "Reply with the single word OK."
echo "exit=$?"

Result: exit=1, and the log carries the provider error:

level=ERROR message=failed ref=err_... error="ProviderModelNotFoundError: Model not found: opencode/totally-bogus-model-zzz."

3. Default (TUI) path, same id — the bug. Needs a TTY:

cd /tmp/oc-repro && opencode --pure --agent build --auto \
  --model opencode/totally-bogus-model-zzz --prompt "Reply with the single word OK."

Result: the prompt is answered normally. The footer reads
Build auto · Muse Spark 1.3 Contributor OpenCode Go — the configured default, not the requested
model. The session record for that run:

message=created ... version=1.18.27 agent=build model.id=muse-spark-1.3-contributor model.providerID=opencode-go

Grepping that run's log lines for the requested id (totally-bogus) returns 0 matches, and the
run logs no WARN or ERROR about the model.

Additional observations

These change the shape of the bug, so they are worth stating explicitly.

  1. Any unresolvable id substitutes, not just a garbage one. Tested both a nonsense id (above) and
    an id that had been retired from the provider's live roster (opencode/x-preview-f-free, still
    listed in an older cached catalog); both behave identically.
  2. The substitute is simply the configured default: an invocation with no --model at all
    produces the same model.id and model.providerID. The flag is inert on this path rather than
    resolving to a nearest match.
  3. The substitution crosses providers. The request named provider opencode; the run used
    provider opencode-go. A pinned provider is not honoured either.
  4. --model is honoured on this path when the id resolves: --model opencode/mimo-v2.5-free
    produced model.id=mimo-v2.5-free model.providerID=opencode. So the gap is missing validation,
    not broken selection.

Suggested shape of a fix

On the default entry path, resolve --model through the same resolution run uses and fail loudly.
At minimum, emit a WARN naming both the requested id and the substitute instead of falling through to
the default silently.

Related

Posted on behalf of @schickling
field value
agent_identity dev3.misc-lead
session dev3.1788b94d
agent_persona teamlead
agent_supervisor dev3.cos
agent_tool OMP
agent_tool_version 18.1.2
agent_runtime OMP 18.1.2
tooling_profile dotfiles@3fdc95b-dirty

Activity

  1. holny commented on Sep 4, 2026

    @holny
    Contributor

    I'd like to take this. Confirmed on current v2: the run path resolves and validates --model, but the default TUI entry drops input.model entirely (handlers/default.ts never passes it into the app), so an unresolvable id silently falls back to the configured default model. Plan: resolve the flag on the TUI entry with the same validation as run and fail fast with a clear error.

  2. holny commented on Sep 9, 2026

    @holny
    Contributor

    Heads-up: the PR for this issue (#47699) was accidentally closed earlier today - its head fork got deleted unintentionally, which force-closed it. Re-filed as #48163 with the same commits. Sorry for the noise.

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