Skip to content

TUI validates --model before providers load, causing false 'Model ... is not valid' #23270

@JasonZhaoWW

Description

@JasonZhaoWW

Description

Starting the TUI with --model openai/gpt-5.4 shows Model openai/gpt-5.4 is not valid, even though the model is listed by opencode models openai and opencode models openai --refresh.

This looks like a TUI startup ordering bug: --model is applied before provider metadata finishes syncing, so local validation rejects a valid model. If the current agent already has its own configured model, the CLI-selected model can also be ignored/overridden instead of staying highest priority.

Possibly related to #17853, #9520, and #7948.

Plugins

No response

OpenCode version

1.4.11

Steps to reproduce

  1. Run opencode models openai and confirm openai/gpt-5.4 is listed.
  2. Run opencode models openai --refresh and confirm openai/gpt-5.4 is still listed.
  3. Start the TUI with opencode --model openai/gpt-5.4.
  4. Observe that the TUI shows Model openai/gpt-5.4 is not valid.
  5. If the current agent already has a configured model, submit a prompt and note that the agent model can win over the CLI-selected model.

Screenshot and/or share link

No response

Operating System

Linux 6.19.11-zen1-1-zen

Terminal

Ghostty

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions