You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: run command exits with 0 on session errors #14551
opencode run always exits with code 0 even when the AI session encounters errors (e.g., session.error events). This breaks CI/CD pipelines and scripts that rely on exit codes to detect failures.
Root Cause
In packages/opencode/src/cli/cmd/run.ts, the loop() promise that processes session events (and tracks the error variable) is not awaited. The execute function returns before the event loop completes, so the accumulated error state is never checked.
Expected Behavior
opencode run should exit with a non-zero exit code (1) when the session encounters errors.
Steps to Reproduce
Run opencode run with a prompt that triggers a session error
The issue does not use one of the required issue templates (Bug Report, Feature Request, or Question). Please re-submit using the Bug Report template, which requires a Description field with reproduction context.
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
opencode run hangs forever on API errors (breaks CLI/automation integrations) #8203: opencode run also fails to properly exit/handle errors in CI/CD automation contexts (hangs indefinitely on API errors rather than exiting with a non-zero code) — the two issues share the same root concern of opencode run not propagating errors correctly for automation use cases.
If you believe this was flagged incorrectly, please let a maintainer know.
Activity
github-actions commentedon Feb 21, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
opencode runalso fails to properly exit/handle errors in CI/CD automation contexts (hangs indefinitely on API errors rather than exiting with a non-zero code) — the two issues share the same root concern ofopencode runnot propagating errors correctly for automation use cases.If you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon Feb 21, 2026
This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.
Feel free to open a new issue that follows our issue templates.