Skip to content

BUG: exit code when an invalid model is passed #15558

@grigio

Description

@grigio

Description

Following and example of the bug, and the reasoning of the AI model as it replied

$ opencode run --model "invalid-model-123" "test" 2>/dev/null ; echo "EXIT: $?"
EXIT: 0
Thinking: So opencode is returning exit code 0 even when it prints an error message! This is a bug in opencode itself (it prints errors to stderr but exits with 0). 
The fix for the harness should be to check if stderr has error content, not just exit code. Let me modify the runner to check stderr for error patterns:
The issue is that opencode returns exit code 0 even when it prints an error message. I need to modify runner.ts to check stderr for errors, not just exit code.

Plugins

none

OpenCode version

1.2.15

Steps to reproduce

$ opencode run --model "invalid-model-123" "test" 2>/dev/null ; echo "EXIT: $?"

Screenshot and/or share link

No response

Operating System

Linux / Archlinux

Terminal

zsh

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything 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