Reference / CLI
Exit codes
These docs describe Kix's main branch, which can include changes not yet released. Read the docs for the latest release.
Every kix command exits 0 on success and 1 when it cannot do what it
was asked: an error it reports, such as an evaluation failure, a build
failure, or an unreachable cluster, and a command line it cannot use. Some
commands also use a non-zero status to report a result, listed below.
This page lists every variant of Exit in cli/kix-cli/src/exit.rs, which
holds every code Kix ends with.
Common codes
Section titled “Common codes”| Code | Meaning |
|---|---|
0 | Success. Also printed help (-h, --help) and version (-V). |
1 | An error, printed on stderr. This includes a command line Kix cannot use: an unknown flag, a missing argument, an invalid value, a command or flag that a release removed, and an -o format the command does not print. |
2 | The command finished and found something to look at: changes from kix diff and kix plan, and a problem kix status found. |
3 | A preview, such as kix plan or kix deploy --dry-run, found that the deploy would stop and wait for a person. kix upgrade also exits 3 when a person should read what changed. |
4 | The saved plan no longer matches what the deploy would do. |
Per command
Section titled “Per command”| Command | Non-zero status beyond errors |
|---|---|
kix diff, kix plan --read-only | 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 -o sarif too. |
kix deploy | 1 when a resource operation fails (under --on-error continue too, and including a failed or timed-out 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 or timed-out 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 times out, 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 status | 2 when an object is missing, changed, or not ready under the selected checks, or when a deploy has failed since the current deploy. Objects Kix could not check do not count. 1 when Kix could not answer, such as when the named cluster has no current deploy. See kix status. |
kix pin check | 1 when a pin fails or, with --source-rev, records a different source revision. Warnings do not fail. |
kix doctor | 1 when the runtime directory cannot be found, manifest.json does not match the compiled-in program versions, any file fails its SHA-256 check, kix.toml is invalid, sets an unsupported builder, or has an invalid or mismatched [versions] table, Kix cannot read the project’s version of Kix from flake.lock or is not that version, or (when builder = "nix") nix on PATH is missing, older than 2.24, or Lix. Warnings and info lines do not fail. |
kix upgrade | 1 when an input or cluster cannot be upgraded, or when a cluster fails to build on its current version or a target version. 3 when the upgrade needs your attention: either it paused for a manual edit to flake.nix or kix.toml, or the builds succeeded with items to review before deploying (manifest changes, sensitive resource changes, behavior or data migrations, or a required intermediate deploy). See kix upgrade. |
kix deploy (before it starts) | 1 when kix-upgrade.json records an unacknowledged data migration for this cluster (acknowledge with kix upgrade --acknowledge). |
kix logs, kix port-forward | 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.
When flake.lock pins another
version of Kix
for the command, Kix runs that installed version in its place and returns its
exit status. If that version is not installed and cannot be installed (or
KIX_AUTO_INSTALL=0 is set), Kix exits 1 before running the command.
kix --version is the exception: it never installs a version, prints the
running version, notes that the pinned version is not installed, and exits 0.