Skip to main content
Staplehire CLI failures print one structured JSON object to stderr and exit with a stable, non-zero code, so humans, scripts, and agents can recover predictably. Branch on the exit code first, then on error.code.
Never grep error.message — the wording can change. Parse error.code (stable) and read error.hint / error.field to fix the request. Log error.requestId when contacting support.

First step when a command fails

Then capture the command’s stderr and inspect the error:

Exit codes

Common error.code values

Error types

AuthenticationError (exit 2)

The CLI could not resolve or validate an API key.

ValidationError (exit 3)

A required value is missing or invalid. Fix the field named by .error.field, then rerun.

NotFoundError (exit 4)

A role, candidate, design, stage, or job ID does not exist or isn’t visible to your organization.

ConflictError (exit 5)

A resource already exists — commonly a duplicate candidate email on the same role.

Poll timeout (exit 9)

jobs poll stopped waiting. It does not mean the job failed.

Capture and branch in a shell script

Agent loop rule: if the same error.code repeats with the same payload, change the inputs or stop — do not retry blindly.

FAQ

To stderr. Successful data prints to stdout, so you can pipe stdout cleanly while still capturing errors separately.
The error.requestId, the exact command, and the timestamp.
The --timeout elapsed. The job may still be running — inspect it with jobs get or poll again.
Related: Authentication · Poll jobs · Command reference