Exit Codes -- Reference

February 23, 2026 ยท View on GitHub

All certz commands return a standard exit code on completion. This page is the consolidated reference for every exit code across all commands.


Universal Exit Codes

These apply to every certz command:

CodeMeaning
0Success -- the operation completed without errors
1Error -- invalid arguments, file not found, wrong password, or operation failed

Command-Specific Exit Codes

Some commands return additional exit codes beyond 0/1 to distinguish between warning and error states.

certz inspect

CodeCondition
0Inspection completed, no warnings
1One or more warnings (e.g., --warn threshold triggered, or validation issues found)

certz inspect returns exit code 1 when warnings[] is non-empty in the result. The most common cause is --warn <days> when the certificate is within that threshold.

certz diff

CodeCondition
0Certificates are identical (all compared fields match)
1One or more fields differ between the two certificates

Exit code 1 signals that differences were found -- it is not an error. To detect errors (source not found, bad password, etc.), check stderr.

certz lint

CodeCondition
0All lint checks passed (no errors found at the requested severity)
1One or more lint errors found

Use --severity error to fail only on errors, not warnings or info findings.

certz monitor

CodeCondition
0All certificates are valid and outside the warning threshold
1One or more certificates are within the warning threshold (--fail-on-warning required)
2One or more certificates have already expired

Exit code 2 (expired) takes precedence over 1 (expiring within threshold). Without --fail-on-warning, expiring-but-not-expired certificates do not affect the exit code -- only already-expired certificates trigger a non-zero result.

certz renew

CodeCondition
0Certificate renewed successfully
1Source certificate not found, invalid, or renewal failed
2Cannot renew -- missing issuer for a CA-signed certificate

Exit Code Summary Table

CommandCodeMeaning
Any0Success
Any1Error (argument, file not found, operation failed)
diff0Certificates are identical
diff1Certificates differ (not an error -- use exit code to drive scripts)
inspect1Warnings present (e.g., --warn threshold triggered)
lint1Lint errors found
monitor1Expiring certs within threshold (--fail-on-warning set)
monitor2Expired certs found (takes precedence over code 1)
renew2Cannot renew -- CA-signed cert missing --issuer-cert

Using Exit Codes in Scripts

Bash / sh

# Fail pipeline if cert has lint errors
certz lint cert.pfx --password "$PASS" --severity error
if [ $? -ne 0 ]; then
  echo "Cert failed lint -- blocking deployment"
  exit 1
fi

# Monitor with fail-on-warning
certz monitor ./certs --warn 30 --fail-on-warning
if [ $? -ne 0 ]; then
  echo "Certificate expiry alert"
  exit 1
fi

# Chaining with &&: stop on first failure
certz lint cert.pfx --password "$PASS" --severity error &&
certz monitor cert.pfx --warn 30 --fail-on-warning &&
echo "All checks passed"

PowerShell

# Fail pipeline if cert has lint errors
certz lint cert.pfx --password $env:CERT_PASS --severity error
if ($LASTEXITCODE -ne 0) {
    Write-Error "Cert failed lint -- blocking deployment"
    exit 1
}

# Monitor with fail-on-warning
certz monitor ./certs --warn 30 --fail-on-warning
if ($LASTEXITCODE -ne 0) {
    Write-Warning "Certificate expiry alert (exit code: $LASTEXITCODE)"
    exit $LASTEXITCODE
}

# Parse JSON and react to specific codes
$result = certz monitor ./certs --format json | ConvertFrom-Json
if ($result.expiredCount -gt 0) {
    Write-Error "Expired certs found: $($result.expiredCount)"
    exit 2
} elseif ($result.expiringCount -gt 0) {
    Write-Warning "Expiring certs: $($result.expiringCount)"
    exit 1
}

GitHub Actions

- name: Lint certificate
  run: certz lint cert.pfx --password ${{ secrets.CERT_PASS }} --severity error

- name: Monitor certificate expiry
  run: |
    certz monitor ./certs --warn 30 --fail-on-warning --format json |
      Tee-Object monitor-results.json
  continue-on-error: true

- name: Fail job if expiring
  run: |
    $r = Get-Content monitor-results.json | ConvertFrom-Json
    if ($r.expiredCount -gt 0 -or $r.expiringCount -gt 0) {
      exit 1
    }

Global Options

These options are available on every certz command:

OptionDescription
--format <text|json>Output format. Use json for scripting and automation.
--guidedLaunch the interactive wizard instead of using flags
--helpShow help text for the command
--versionShow the certz version