Reference CLI
Exit codes
What each `kix` command's exit status means, so CI jobs and scripts can branch on the result.
Every kix command exits 0 on success and 1 on an error it reports, such
as an evaluation failure, a build failure, or an unreachable cluster. Some
commands also use a non-zero status to report a result, listed below.
This page is hand-maintained. Check the std::process::exit calls in
cli/kix-cli/src/commands/ when in doubt.
Common codes
Section titled “Common codes”| Code | Meaning |
|---|---|
0 | Success. Also printed help (-h, --help) and version (-V). |
1 | An error, printed on stderr. |
2 | The command line could not be parsed: an unknown flag, a missing argument, or an invalid value. kix diff and kix plan also use 2, see below. |
Per command
Section titled “Per command”| Command | Non-zero status beyond errors |
|---|---|
kix diff | 2 when there is at least one difference or a stateful migration was detected. 0 means no differences. |
kix plan, kix deploy --dry-run | 2 when the deploy would change something or the prune would delete something. 3 when it would stop: a refused write, a refused prune delete, or a stateful migration without --accept-migrations. 0 means the deploy would change and delete nothing. |
kix deploy --plan | 4 when the reviewed plan no longer matches the plan made now; nothing is applied. With --dry-run, 3 when it matches but the deploy would stop (a refused write, or a migration not accepted), and 0 when it matches and would not. See Deploy a reviewed plan. |
kix check | 1 when any step reports fail: cluster evaluation, which includes error-level scorecard findings, or the scorecard report. Applies with --sarif too. |
kix deploy | 1 when a resource operation fails (under --on-error continue too, and including a prune delete) or the run is stopped or cancelled, when the plan shows a refused write under --on-error stop, when stateful migrations are detected without --accept-migrations, or when confirmation is needed on a non-interactive terminal without --yes. With --operator, a Degraded, Failed, or unexpectedly Superseded Activation and a 10-minute wait timeout also exit 1. |
kix rollback | 1 when the rollback fails, including a failed prune delete or, with --operator, a Degraded Activation, or when confirmation is needed on a non-interactive terminal without --yes. |
kix gc | 1 when any deletion fails, or when confirmation is needed on a non-interactive terminal without --yes. |
kix migrate domain | 1 when confirmation is needed on a non-interactive terminal without --yes. |
kix health | 1 when any package is not healthy. |
kix drift | 1 when any resource has drifted. Unstamped resources do not count. |
kix pin check | 1 when a pin fails or, with --source-rev, records a different source revision. Warnings do not fail. |
kix logs, kix pf | kubectl’s exit status. Kix replaces itself with kubectl once the workload is found. |
Answering no to a confirmation prompt (deploy, rollback, gc,
migrate domain) exits 0 without changing anything.
A kix diff or kix plan in CI cannot tell a difference from a usage error
by the code alone. Check that the command line is valid in a step that does
not branch on 2, or read the JSON output.