Skip to content

opencode run exits with status 0 for invalid model when prompt is provided #26509

Closed as not planned

Description

@vedantnaik19

Description

Description

Running opencode run with an invalid model and a prompt/message argument produces a ProviderModelNotFoundError, but the process exits with status code 0.

This only appears to happen when a prompt/message is provided.

Command

opencode run -m invalid-model "some message"
echo $?

Plugins

No response

OpenCode version

1.14.41

Steps to reproduce

  • Run: opencode run -m invalid-model "build"
  • Notice it prints ProviderModelNotFoundError / Model not found
  • Run: echo $?
  • Notice the exit code is 0
  • [Optionally] Compare with: opencode run -m invalid-model without a prompt/message

Screenshot and/or share link

No response

Operating System

macOS 26.4

Terminal

Mac Terminal

Activity

  1. github-actions commented on May 9, 2026

    @github-actions
    Contributor

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

    Both are closed; if the fix was reverted or the behavior regressed, it may be worth referencing those issues and confirming the version where it was fixed.

  2. cokekitten commented on May 9, 2026

    @cokekitten

    Have a small fix for this — setting process.exitCode = 1 in the session.error handler inside run.ts's loop(), which matches the existing pattern in thread.ts and attach.ts. Opening a PR shortly.

    For context, prior attempt PR #15787 (same bug as surfaced in #15558 / #17854 / #2489) was auto-closed by the template-compliance bot before any human review.

    Happy to defer if anyone's already working on it.

  3. github-actions commented on Jul 9, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 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

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions