REA exit codes (unofficial)
Shell scripts should treat REA’s process status and its structured JSON result as separate signals. Documented in docs/cli.md — Output and exit status for the 6.7.x line (npm 6.7.0 checked 2026-10-24).
Status table
| Status | Meaning (upstream summary) |
|---|---|
| 0 | Operation completed; may still carry partial evidence / warnings / unresolved questions |
| 1 | Operation could not complete (invalid input, permissions, timeout, etc. when structured) |
| 128 + N | Signal-derived status (e.g. 130 SIGINT, 143 SIGTERM) |
| 141 | Common when stdout hits a closed pipe (128 + 13 SIGPIPE) |
Long-running servers (rea mcp --http, rea environment-serve) use the signal statuses after cleanup; cleanup failure can still yield 1.
Scripting tips
set -o pipefail # keep REA's failure status through jq
rea analyze /abs/path --provider ghidra --json | jq . > out.json
echo $?
- Prefer
--jsonfor agents and CI. - A printed
cancelledobject does not alone define the exit code — signal handling matters (see cli.md). inspect-artifactcancellation may exit1even with a structured cancelled result (upstream special case).doctor→1when required checks in the selected scope fail; unrelated optional engines can stay informational.
Pair with errors guide
CI treats exit 0 as “binary fully understood”Fix: Do not. Parse Evidence limitations / unresolved fields even on status 0.
Pipeline loses exit 1 after jqFix: Enable pipefail or write JSON to a file without a fragile pipe.
Related
RepoRead is unofficial. Authorized targets only.
FAQ
Does exit 0 mean the analysis is perfect?
No. Upstream says 0 means the operation completed; the result may still include partial evidence, warnings or unresolved questions.
What is exit 1?
The operation could not complete. Prefer structured JSON error fields when you passed --json.
What are 130 and 143?
Conventional signal-derived statuses — 128+2 for SIGINT, 128+15 for SIGTERM — including handled cancellation paths described in docs/cli.md.
Why did I see 141 with head?
Writing to a closed pipe (e.g. rea … | head) can exit 141 (128+13 SIGPIPE) even if the operation itself finished.
Does setup cancellation exit 1?
Upstream notes cancelled setup exits 0; setup --dry-run planned also exits 0. Doctor returns 1 when required checks in scope fail.