Exit codes#

A command ends with the code of its outcome. Codes 0, 1 and 2 keep their usual meaning, 130 is the POSIX code of an interrupted process, and the codes from 10 name the category of the failure. An exception that a command does not catch ends with the code of its class.

CodeNameRaised forSet directly by
0EXIT_OKNothing: the command succeeded.
1EXIT_GENERICAny exception that no other row maps.
4 commands
hmp catalog query, hmp export, hmp publish, hmp doctor
2EXIT_USAGE-
19 commands
hmp project delete, hmp campaign case, hmp campaign prune, hmp example add, hmp catalog delete, hmp catalog trash, hmp catalog tag, hmp catalog rerun, hmp data remove, hmp data prune, hmp data lock, hmp ls, hmp show, hmp export, hmp publish, hmp run, hmp calibrate, hmp site import, hmp doctor
10EXIT_NOT_FOUNDFileNotFoundError
32 commands
hmp workspace list, hmp workspace clean, hmp project new, hmp project delete, hmp project list, hmp project import, hmp campaign promote, hmp campaign prune, hmp example add, hmp catalog query, hmp catalog gc, hmp catalog watch, hmp data ls, hmp data get, hmp data remove, hmp data prune, hmp data archive, hmp data restore, hmp ls, hmp show, hmp diff, hmp check, hmp publish, hmp run, hmp replay, hmp calibrate, hmp spinup, hmp site add, hmp site import, hmp site ls, hmp site show, hmp doctor
11EXIT_SCHEMA_MISMATCH-
12EXIT_WRITE_CONFLICTFileExistsError
1 commands
hmp project delete
13EXIT_READ_ONLY-
14EXIT_CONFIG-
13 commands
hmp workspace init, hmp workspace clean, hmp project plan, hmp data get, hmp show, hmp check, hmp config, hmp run, hmp calibrate, hmp spinup, hmp site add, hmp doctor, hmp install-binaries
15EXIT_SOLVER_ERROR-
16EXIT_VALIDATION-
3 commands
hmp data get, hmp data lock, hmp diff
17EXIT_CROSS_PROJECTS-
18EXIT_BACKUP_FAILED-
19EXIT_MIGRATION_FAILED-
20EXIT_AMBIGUOUS_REFERENCE-
21EXIT_CALIBRATION-
2 commands
hmp run, hmp calibrate
22EXIT_CATALOG_UNREADABLE-
23EXIT_CASES_FAILED-
1 commands
hmp run
130EXIT_SIGINTKeyboardInterrupt
7 commands
hmp project delete, hmp campaign prune, hmp catalog delete, hmp catalog trash, hmp data remove, hmp data prune, hmp run

The code of a failure#

A failure prints one line on stderr that starts with its HMPY.Exxx code: HMPY.E002: File not found: run.toml. Exceptions and error codes lists the classes and their codes. A refusal the command writes itself takes the code of the class of its exit code. HMPY.E000 is a failure with no category of its own, most often a bug of ours. What a program reads says what a failure prints under --format json.

What is promised#

Inside a major version an exit code keeps its number and its meaning, and an HMPY.Exxx code keeps its meaning. A new category comes with a new number, so a program reads a number it does not know as a failure. The words of a message can change in any version, so a program reads the codes and never the words.

Codes each command sets itself#

Read from the code of each command: every refusal and every sys.exit it reaches. A command that is not listed ends with 0, with 1 for an error, or with the code of an uncaught exception.