Exit status and error recovery
Most CLI commands use 0 for success and 1 for a general failure. Collaboration commands provide a more specific stable exit-status set. Error prose is for people; automation should prioritize exit status and JSON fields.
Exit statuses are intended for scripts and terminal automation. For runtime state, approval requests, or device connectivity, use App Diagnostics and support, Approvals, and Devices and security.
General behavior
| Status | Meaning |
|---|---|
0 | The command completed as requested. Still inspect JSON business state when required |
1 | General error, network error, invalid state, or a failure outside collaboration-specific classes |
| Child status | originrouter run -- <command> propagates the child process exit status |
143 | The Agent Workspace terminal UI received SIGTERM |
An HTTP status is not a process exit status. Authentication and service failures are normally rendered as a readable headline, technical detail, and Next: action, then exit with 1.
Collaboration exit status
| Status | Meaning | Recommended action |
|---|---|---|
2 | Invalid arguments, usage, draft, or input | Correct the command and inspect originrouter --help |
3 | Local daemon or Local API unavailable | Check service status, then service restart if needed |
4 | Login, device trust, E2EE, identity, or workspace permission failure | Check login status, trusted devices, and the permission profile |
5 | Runtime, provider, model, route, or capability unavailable | Run doctor on the target device and repair its route |
6 | The run entered failed | Run collaboration doctor <run-id>, fix the cause, then retry |
7 | Budget exhausted, budget exceeded, or policy blocked | Review run, device, agent budget, or organization policy |
8 | Configuration or plan requires confirmation in a non-interactive flow | Review the run and execute confirm; use --yes only when deliberately accepting both startup gates |
10 | Device offline, relay timeout, connection interruption, or incomplete Local API response | Inspect actual run state before deciding whether to create again |
Status 10 can mean that the request result is uncertain. A daemon-owned run may still be active, so query the same run ID with show or doctor.
JSON automation
if output=$(originrouter collaboration show "$run_id" --json); then
state=$(printf '%s' "$output" | jq -r '.state')
else
status=$?
printf 'originrouter failed with status %s\n' "$status" >&2
exit "$status"
fi
For create commands, persist the first returned run ID. After a network interruption, query that ID; create another run only after confirming that the original request was not accepted.
Recovery order
- Read the complete error, including
Impact,Action, andDiagnostic code. - When supported, repeat a read-only command with
--json. - Check
login status,service status, anddoctor. - For an existing collaboration, run
collaboration doctor <run-id>. - Repeat a create or write operation only after confirming that the original request was not accepted.
Common authentication failures already map to concrete recovery actions such as signing in again, updating an old CLI, revoking an unused device, or waiting for the key-rotation limit to reset.