Repository navigation
Description
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 -q2. 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.
- 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. - The substitute is simply the configured default: an invocation with no
--modelat all
produces the samemodel.idandmodel.providerID. The flag is inert on this path rather than
resolving to a nearest match. - The substitution crosses providers. The request named provider
opencode; the run used
provideropencode-go. A pinned provider is not honoured either. --modelis honoured on this path when the id resolves:--model opencode/mimo-v2.5-free
producedmodel.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
- [bug] opencode run: unknown model returns a generic 500 UnknownError instead of a 404 with the "did you mean" message #47162 covers the error shape on the
runpath (generic 500 rather than a 404 with the
"did you mean" message). Therunpath at least fails. This report is that the default path does
not fail at all. - Task tool ignores 'model' field in subagent config, always uses opencode/deepseek-v4-pro" --body #37797 is the same family on a different surface (the Task tool ignoring a subagent
modelfield).
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
holny commentedon Sep 4, 2026
I'd like to take this. Confirmed on current
v2: therunpath resolves and validates--model, but the default TUI entry dropsinput.modelentirely (handlers/default.tsnever 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 asrunand fail fast with a clear error.holny commentedon Sep 9, 2026
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.
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 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊