Exit Codes
Consistent exit code contract
A consistent exit code contract applies across all syndicate commands (cli_command_reference.md §18):
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error (execution failure, unexpected error) |
| 2 | Denied (policy denial, approval denial) |
| 3 | Interrupted (operator-initiated or timeout) |
| 4 | Dry run — operation would be denied |
| 5 | Control plane unavailable |
| 6 | Authentication or identity failure |
| 7 | Validation failure (policy schema, specialist definition, etc.) |
| 8 | Not found (specified session, permit, specialist, etc. does not exist) |
Workflow-specific exit codes
syndicate run uses the following exit codes (cli_command_reference.md §6.3):
| Code | Meaning |
|---|---|
| 0 | Workflow completed successfully |
| 1 | Workflow failed (execution error) |
| 2 | Workflow denied (policy or approval denial) |
| 3 | Workflow interrupted (operator or timeout) |
| 4 | Dry run completed — would be denied |
| 5 | Control plane unavailable |
Audit verification exit codes
syndicate audit verify exits with code 0 if the chain is intact, non-zero if any integrity violation is detected. The first detected violation is reported (cli_command_reference.md §8.4).
Failure behavior on exit
Control plane unavailable (code 5)
If the CLI cannot reach the control plane at startup (cli_command_reference.md CLI-FH-001):
- emit a clear error message identifying the failure as a control plane connectivity issue
- exit with code 5
- do not attempt any governed operation
Audit write failure (code 1)
If a mutating command cannot confirm that its audit event was durably written (cli_command_reference.md CLI-FH-003):
- do not complete the mutation
- report the audit write failure to the operator
- exit with code 1
This implements the audit failure behavior from the product system definition — audit write failure produces a hard block.
Interrupted mutating command
If a mutating command is interrupted (SIGINT, SIGTERM) before completion (cli_command_reference.md CLI-FH-004):
- do not leave the control plane in an indeterminate state
- emit a diagnostic message describing the interrupted operation
- the control plane's optimistic concurrency model handles rollback of partial mutations
Exit code invariants
- INV-CLI-008 — Exit codes must be consistent across commands. Exit code 0 means success; exit code non-zero means a distinct failure class.