Skip to content

`forensics` CLI exit codes

The forensics Typer CLI uses a small, stable set of process exit codes so scripts and automation (including AI agents) can branch without parsing stderr.

CodeNameMeaning
0OKSuccess
1GENERAL_ERRORUnclassified failure
2USAGE_ERRORMissing/invalid flag, mutually exclusive flags, malformed argument value
3AUTH_OR_RESOURCEMissing prerequisite resource (database file, model file, unreachable dependency, write-protected directory)
4TRANSIENTNetwork timeout, rate limit, retryable I/O — safe for an agent to retry after backoff
5CONFLICTAlready exists / already done (e.g. lock present, schema already current, corpus hash drift vs custody)
  • Retry on 4 only — use exponential backoff; do not spin in a tight loop.
  • Treat 5 as idempotent / settled — the system is already in (or refuses to leave) a state that matches a “no further action” outcome; do not retry the same command expecting a different 5 without changing inputs or environment.
  • Do not blindly retry 1, 2, or 3 — these usually require fixing configuration, restoring files, or human intervention. Inspect logs (stderr) or structured JSON (--output json) when available.

The root forensics --help epilog points here for quick reference.