Exit code reference
| Code | Name | When it’s used |
|---|---|---|
0 | Success | Command completed successfully |
1 | General error | Unexpected internal failure (uncaught exception, bug) |
2 | Usage error | Command-line parse failure from the CLI framework: unknown command, nonexistent flag, missing required argument or flag, invalid enum value |
4 | Validation | Local precondition failed: missing/invalid token, malformed YAML, request body that doesn’t match the schema |
10 | Changes pending | plan / deploy --dry-run --detailed-exitcode detected pending changes |
11 | API error | API returned a non-2xx response (4xx or 5xx). Carries status, code, and requestId in stderr |
12 | Transport | Network failure before getting a response: DNS, connection refused, TLS, timeout |
13 | Partial failure | deploy finished but at least one resource operation failed; the remainder succeeded |
src/lib/errors.ts (EXIT_CODES). Sub-classes (e.g. DevhelmAuthError, DevhelmNotFoundError) inherit their root’s exit code. Exit 2 comes from the oclif framework before the command runs, so it is not part of EXIT_CODES.
Quick decision table
| You want to… | Check |
|---|---|
| Detect any failure | $? -ne 0 |
| Distinguish “config drift” from real errors in CI | $? -eq 10 for drift, $? -eq 0 for clean, anything else for failure |
| Retry only on transient failures | Retry on 12; do not retry on 2, 4, or 11 (deterministic) |
| Surface auth problems to users | Look for 4 (no token / bad config) or 11 with code=UNAUTHORIZED / code=FORBIDDEN in stderr (rejected token) |
| Continue past partial deploy failure | Treat 13 as “completed with errors” and inspect the deploy report |
Usage in CI
Gate merges on config drift
Use--detailed-exitcode with deploy --dry-run to detect config changes in a PR check:
| Exit code | CI behavior |
|---|---|
0 | Config is in sync — pass the check |
10 | Config has changes — fail or flag for review |
2 / 4 / 11 / 12 | Error — fail the check |
Shell scripting
GitHub Actions
Next steps
Deploy commands
Full deploy, plan, and validate reference.
GitHub Actions
CI/CD integration with the setup-devhelm action.