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
2USAGEInvalid flags, missing config file, missing required args
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"
  }
}

Agent retry guidance

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