Skip to content

Exit codes

Contract for agents and CI scripts invoking sp.

CodeNameMeaning
0SuccessParsed JSON on stdout when --json
1API_ERRORBackend returned error or HTTP non-success (includes NO_RECORDED_CASES on replay run)
2USAGE / PROFILE_NOT_FOUND / CONFIG_*Invalid flags, missing config, parse errors, unknown profile
3AUTH_REQUIREDNo token available in non-interactive mode

stderr with --json

On exit 1 or 2 or 3, stderr contains a JSON error object:

json
{
  "ok": false,
  "command": "app list",
  "error": {
    "code": "AUTH_REQUIRED",
    "message": "Set SP_TOKEN or run sp auth login"
  }
}

Config error codes (exit 2)

CodeCause
CONFIG_MISSINGNo config.jsonc / sp.jsonc; run sp config init
CONFIG_PARSE_ERRORInvalid JSONC or schema validation failure
CONFIG_WRITE_ERRORCould not write config file
PROFILE_NOT_FOUNDSelected profile missing from merged config

Agent retry guidance

CodeRetry?
0No
1Sometimes — after fixing data or if transient 5xx
2No — fix invocation
3After refresh/login

Zero code changes · Full-context visibility · Cost optimization