Exit Codes
Every command exits with one of five codes. Branch on the code, never on the text of a message.
The codes
| Code | Meaning | Raised when |
|---|---|---|
0 | Success | The command completed. For validation commands it also means nothing was found above the configured failure threshold. |
1 | Command failure | The operation ran and failed: a migration error, a validation failure, an unexpected exception. The log carries the detail. |
2 | Usage error | Arguments could not be parsed, or configuration could not be resolved. Nothing touched the database. |
4 | Licence required | A paid command on the open-source package, or the commercial package without a licence. validate-sql on the open-source package never returns 4. A paid flag there is an argparse error and exits 2. |
130 | Interrupted | Cancelled by the user with Ctrl-C. Follows the shell convention of 128 plus the signal number. |
Entitlement is not failure
Code 4 exists so pipelines can branch on entitlement without parsing stderr. It is distinct from 1 (command failure) and 2 (usage error).
Branching in CI
dblift validate-sql --format sarifcase $? in0) echo "clean" ;;2) echo "usage error: paid flag on the open-source package" ;;*) exit 1 ;;esac
--format sarif is an invalid --format choice on the open-source package, and a positional path is an unrecognized argument. Both are Pro. On pip install "dblift[cli]" they exit 2. validate-sql on that package never returns 4. A paid command such as diff on the open-source package, or the commercial package without a licence, exits 4.
Machine-readable stdout
Five output formats are a parser-facing contract rather than a human-facing report. When a command runs with one of them, stdout carries the payload alone — no banners, no log lines, no completion messages. Everything else goes to stderr.
json · sarif · github-actions · gitlab · compact
Redirect stdout to a file and let stderr reach the log. Parsing anything outside these formats is unsupported.
See CI/CD Integration for full pipeline examples.