Skip to main content

Exit codes

CLI exit codes per clig.dev (success, error, usage) plus the quality-gate codes.

The first three codes are the CLI-wide contract every command honours. The gate codes (3–5) are used only by the pre-flight surface (IXH-2.6): import preflight / export preflight and the --min-grade / --fail-on flags on the import and export commands. They exist so a CI job can tell "the spec is not good enough" apart from "the network was down" (EXIT_ERROR) or "the credentials were wrong" (EXIT_USAGE, which every 4xx — including 401/403 — maps to), which is the whole point of gating in a pipeline.

Failed import/export jobs reuse codes 1–3 via apiome_cli.taxonomy_exit (IXH-6.4): taxonomy policy → 3, caller-fault categories → 2, transport/internal → 1.

CodeNameMeaning
0EXIT_SUCCESSThe command did what was asked.
1EXIT_ERRORTransport failure, server error (5xx), or an unexpected client-side failure.
1EXIT_DIFFERENCESapiome schema diff --exit-code (CLI 9.8): git-like — the two versions differ (after --scope and --ignore). Deliberately the value of EXIT_ERROR, like git diff --exit-code; under --exit-code the command remaps transport/5xx errors to EXIT_USAGE so 1 is unambiguous. Without --exit-code it is never used.
2EXIT_USAGEBad invocation, or a rejected request (any 4xx — including authentication).
3EXIT_POLICY_BLOCKEDThe tenant's import/export quality policy (IXH-2.3) blocks this payload. The report was produced successfully; the answer is "policy refuses this". A waiver that covers the shortfall downgrades the verdict server-side, so a waived payload does not exit with this code — it is reported as waived and passes.
3EXIT_FIXES_REMAINapiome lint --fix (GVM-3.3): every fix that could be applied was, but fixes remain that need a person — a breaking fix (never applied, whatever the flags) or a conflict fix (it becomes ready once the fix it conflicts with is in; run --fix again). --dry-run never exits with this code. Another per-command use of 3.
4EXIT_QUALITY_GATEA --min-grade or --fail-on threshold supplied on the command line was not met. Distinct from EXIT_POLICY_BLOCKED: the tenant policy allowed the payload and the caller's own, stricter CI threshold rejected it.
4EXIT_CROSS_TENANTapiome properties copy (CLI 6.6): --to <tenant>/<project> names another tenant; properties are copied within one tenant only, so nothing was copied. Another per-command use of 4.
5EXIT_PREFLIGHT_UNUSABLEThe pre-flight completed but its subject is unusable: an import candidate that cannot be parsed at all (ok: false), or an export whose every ranked target is blocked or unavailable. Nothing the caller can grade — there is no artifact to gate.
6EXIT_SCHEMA_TEST_FAILEDapiome schema test (IXH-5.5) ran its cases and at least one failed: a payload expected to satisfy the schema did not (or vice versa), or a generated mutant did not violate the constraint it was built to violate. Distinct from EXIT_ERROR (transport/5xx) and EXIT_USAGE (auth or an unresolvable schema reference — any 4xx) so CI can tell "the tests failed" apart from "the tests could not run".
6EXIT_UPDATE_CONFLICTapiome projects update (CLI 3.4): the project changed since it was read — the updated_at in the --from-file dump (or the one read just before the write) no longer matches the server's, so nothing was written. Re-fetch with apiome projects get <id> --json and apply again. Shares the value 6 with EXIT_SCHEMA_TEST_FAILED: codes above 5 are per-command, and the two commands never overlap.
6EXIT_PUBLISHED_VERSIONSapiome projects delete (CLI 3.5): the project still has published versions — specs consumers can fetch — and --force was not passed, so nothing was deleted or archived. Unpublish them first, or pass --force. Another per-command use of 6.
6EXIT_VERSION_EXISTSapiome versions fork (CLI 4.4) / apiome versions create (CLI 4.3): the project already has the --to / --version label, so nothing was created. Choose another label. Another per-command use of 6.
6EXIT_VERSION_LOCKEDapiome classes create (CLI 7.3): the version is published or frozen, so no class can be added to it; nothing was created. Create a draft version and add the class there. Another per-command use of 6.
6EXIT_LAST_PUBLISHED_VERSIONapiome versions unpublish (CLI 4.6): the version is the project's only published version, so unpublishing it would leave consumers nothing to fetch; nothing was unpublished. Pass --force to unpublish it anyway. Another per-command use of 6.
6EXIT_SNAPSHOT_DOWNLOADEDapiome versions freeze --unfreeze (CLI 4.7): the frozen snapshot has already been downloaded, so a consumer may depend on its exact bytes; nothing was unfrozen. A tenant administrator can pass --force-unfreeze. Another per-command use of 6.
6EXIT_BREAKING_CHANGESapiome versions compatibility (CLI 4.8): at least one unsuppressed breaking change between --base and --head (--ignore / --allow-removals suppress). The CI gate's failure verdict. Another per-command use of 6.
6EXIT_SHADOW_FOUNDapiome connectors shadow-report --fail-on (CDG-1.6): at least one report category named in --fail-on (shadow, possible-matches, undeployed, drift) has a row. Only the named categories count; an unnamed one never fails the command. Another per-command use of 6.
6EXIT_DELETE_REFUSEDapiome versions delete (CLI 4.9): the version is published or frozen and --force was not passed, or version tags still point at it and neither --detach-tags nor --force was passed; nothing was changed. Another per-command use of 6.
6EXIT_TAG_EXISTSapiome tags create (CLI 11.5): the project already has a version tag with that name (checked first, and the server's 409 TAG_NAME_CONFLICT); nothing was created. Move the existing tag with tags update instead. Another per-command use of 6.
6EXIT_TAG_LOCKEDapiome tags update / tags delete (CLI 11.6 / 11.7): the tag is immutable (checked first, and the server's 409 TAG_IMMUTABLE), so it can never be moved or deleted; nothing was changed. Another per-command use of 6.
6EXIT_PROPERTY_BREAKINGapiome properties update --primitive (CLI 6.4): classes use the property as required, so changing its primitive could break them; nothing was changed. The affected class attributes are listed; pass --allow-breaking to change it anyway. Another per-command use of 6.
6EXIT_PROPERTY_IN_USEapiome properties delete (CLI 6.5): the property is in use by class attributes (listed), or a forced delete found uses in published versions; nothing was deleted. Pass --force --yes to remove the attributes and delete in one step. Another per-command use of 6.
6EXIT_CHECKSUM_MISMATCHapiome schema arazzo / schema json --expect-sha256 (CLI 9.6 / 9.7): the downloaded document's SHA-256 does not match the expected digest; nothing was written. Another per-command use of 6.
7EXIT_CHECK_FAILEDapiome checks run / checks show (GNC-3.1): the API change check suite failed — a required component judged the change unacceptable. Distinct from EXIT_ERROR (the suite could not be reached) and EXIT_USAGE (a rejected reference or credential) so CI can gate on the verdict itself.
7EXIT_ARAZZO_INVALIDapiome arazzo validate (COA-1.5, #7041): the Arazzo document fails structural validation, or a stored revision has a step whose operationRef / operationId did not resolve or a source description no tier found. Distinct from EXIT_USAGE (bad flags, an unreadable file, an unknown project) so CI can gate on the verdict itself. Another per-command use of 7.
7EXIT_ARAZZO_RUN_FAILEDapiome arazzo run (COA-1.7, #7043): the workflow ran and a step's success criteria failed (or a step errored), or the run was refused for a reason other than mutation safety — an unresolved step, a nested-workflow step, inputs the workflow's schema rejects. A run refused because a mutating step lacked policy, opt-in or fixture exits EXIT_POLICY_BLOCKED instead. Another per-command use of 7.
7EXIT_PROPERTY_INVALIDapiome properties create (CLI 6.3): the new property is invalid — a field-level problem such as an unknown primitive or an example its schema rejects; one line per field on stderr, nothing was created. Another per-command use of 7.
7EXIT_PRIMITIVE_MISSINGapiome properties copy (CLI 6.6): a property to copy has a $ref to a primitive the tenant does not have; each property and reference is listed and nothing was copied. Import the primitives first. Another per-command use of 7.
7EXIT_PRIMITIVE_IMPORT_FAILEDapiome primitives import (CLI 5.6): at least one row failed — it is not a valid primitive, or the server refused it; each failed row is listed. Without --continue-on-error nothing was written when the failure was found before the import. Another per-command use of 7.
7EXIT_CHECK_FAILEDapiome checks run / checks show (GNC-3.1): the API change check suite failed — a required component judged the change unacceptable. Distinct from EXIT_ERROR (the suite could not be reached) and EXIT_USAGE (a rejected reference or credential) so CI can gate on the verdict itself.
7EXIT_PROPERTY_INVALIDapiome properties create (CLI 6.3): the new property is invalid — a field-level problem such as an unknown primitive or an example its schema rejects; one line per field on stderr, nothing was created. Another per-command use of 7.
7EXIT_PRIMITIVE_MISSINGapiome properties copy (CLI 6.6): a property to copy has a $ref to a primitive the tenant does not have; each property and reference is listed and nothing was copied. Import the primitives first. Another per-command use of 7.
7EXIT_PRIMITIVE_IMPORT_FAILEDapiome primitives import (CLI 5.6): at least one row failed — it is not a valid primitive, or the server refused it; each failed row is listed. Without --continue-on-error nothing was written when the failure was found before the import. Another per-command use of 7.
7EXIT_RECORD_INVALIDapiome data create (CLI 10.3): the record does not satisfy its class schema — checked locally against the class's frozen JSON Schema before anything is sent; one field: message line per problem on stderr, nothing was created. Another per-command use of 7.
7EXIT_IMPORT_FAILEDapiome data import (CLI 10.7): at least one row failed — it could not be read, did not satisfy the class schema, or the server refused it (after retries on 429 / 5xx). Without --continue-on-error the import stops at the first failure; with it every row is tried and the exit is 0 (the report's failed_count says how many failed). Another per-command use of 7.
7EXIT_SYNC_FAILEDapiome connectors sync --wait (CDG-1.7): the sync ran and failed — the provider refused or the import broke; the run is printed with its error class. Distinct from EXIT_ERROR (Apiome could not be reached) and EXIT_USAGE (a rejected request) so a pipeline can gate on the run's outcome. Another per-command use of 7.
7EXIT_REFRESH_CHECK_FAILEDapiome catalog refresh check (MFI-31.1): the live check ran and failed — the endpoint was unreachable or refused discovery; the item is unchanged and its next scheduled check backs off. Distinct from EXIT_ERROR (Apiome could not be reached) and EXIT_USAGE (a rejected request) so a pipeline can gate on the check itself. Another per-command use of 7.
7EXIT_EXPORT_PARTIALapiome export <format> --items (E1-3): the batch export ran and some items failed — the archive holds the completed ones and the outcome table names the failures. Distinct from EXIT_ERROR (every item failed, or Apiome could not be reached) so a pipeline can tell a partial archive from none. Another per-command use of 7.
8EXIT_CHECK_PENDINGapiome checks run / checks show (GNC-3.1): the suite has no verdict yet — a required component is waiting on evidence (a contract run of this draft), or the commit is ahead of the draft the suite judges. Neither a pass nor a failure, so neither 0 nor 7: a pipeline decides whether "not yet" blocks it.
8EXIT_COMPAT_UNAVAILABLEapiome versions compatibility (CLI 4.8): the server could not be reached, or failed fetching either side of the comparison — no verdict, so neither 0 nor 6. Another per-command use of 8.