Skip to content

[BUG] Using --prompt causes the wrong model to be selected. #8551

Closed

Description

@arkaydeus

Description

When you just run opencode, it launches with the default model which the user has selected. This is good.

But when you then run opencode --prompt "What is this repo?", instead of exactly the same behavior but with the prompt, it launches with Gemini 3 Pro via Github as the provider.

Adding --prompt has nothing to do with the model. So forcing this model which will often fail, is an undesirable and unrelated outcome that appears to be a bug.

Plugins

No response

OpenCode version

1.1.20

Steps to reproduce

opencode --prompt "What is this repo?"

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. changed the title [-][BUG][/-] [+][BUG] Using --prompt causes the wrong model to be selected.[/+] on Jan 14, 2026
  2. github-actions commented on Jan 14, 2026

    @github-actions
    Contributor

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

    Both issues appear to involve model selection being unintentionally changed when using different flags or commands (--prompt flag in this case, /command in #8452). The underlying cause may be related to how model defaults are handled when alternative invocation methods are used.

    Feel free to ignore if this specific case differs from the linked issue.

  3. arkaydeus commented on Jan 14, 2026

    @arkaydeus
    Author

    To add to this, if you have "model", in your opencode.json, this bug doesn't appear. But if you don't and your default is the last selected model (most people are in this position), then the bug persists.

  4. rekram1-node commented on Jan 14, 2026

    @rekram1-node
    Contributor

    I believe there is a timing issue here where the prompt submits prior to the tui having last used model available

  5. thdxr commented on Mar 25, 2026

    @thdxr
    Member

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions