Supercheck LogoSupercheck

Error Handling

API error codes, formats, and retry behaviorEdit

Error Response Format

All error responses return a JSON body with an error field:

{
  "error": "Not found"
}

Some errors include additional context:

{
  "error": "Validation failed",
  "details": [
    { "field": "name", "message": "Name is required" }
  ]
}

HTTP Status Codes

StatusMeaningAction
200Success
201CreatedResource created successfully
400Bad RequestFix the request body or parameters
401UnauthorizedCheck token validity and permissions
403ForbiddenInsufficient RBAC permissions
404Not FoundVerify the resource ID exists
409ConflictDuplicate resource (e.g. token name)
429Rate LimitedWait and retry (see Retry-After header)
500Server ErrorRetry with backoff; report if persistent

Retry Behavior

The Supercheck CLI implements automatic retries for transient errors:

Error TypeRetryStrategy
5xx Server Error3 attemptsExponential backoff (1s, 2s, 4s)
429 Rate LimitedUp to 3Respects Retry-After header
4xx Client ErrorNo retryImmediate failure
Network Timeout3 attemptsExponential backoff

Retry-After Header

When rate limited, the server returns a Retry-After header with the number of seconds to wait:

HTTP/1.1 429 Too Many Requests
Retry-After: 60

The CLI parses this header safely — non-numeric or negative values fall back to exponential backoff instead of causing a tight retry loop.

CLI Exit Codes

The CLI maps errors to specific exit codes for scripting and CI/CD:

Exit CodeMeaningExample
0SuccessJob completed, resource created
1General errorTest failed, validation error
2Authentication errorInvalid token, expired token
3Configuration errorMissing config, invalid schema
4Network / API errorAPI unreachable, 5xx response
5TimeoutOperation exceeded --timeout

CI/CD Usage

# Exit code determines pipeline outcome
supercheck job trigger $JOB_ID --wait
if [ $? -eq 0 ]; then
  echo "All tests passed"
elif [ $? -eq 1 ]; then
  echo "Tests failed"
elif [ $? -eq 2 ]; then
  echo "Authentication issue — check SUPERCHECK_TOKEN"
fi

Common Errors

Invalid Token

HTTP/1.1 401 Unauthorized
{"error": "Unauthorized"}

Fix: Verify your token is valid with supercheck whoami. Create a new token if needed.

Token Expired

HTTP/1.1 401 Unauthorized
{"error": "Token expired"}

Fix: Create a new token in the dashboard or via API.

Insufficient Permissions

HTTP/1.1 403 Forbidden
{"error": "Insufficient permissions"}

Fix: The CLI token inherits the creating user's RBAC role. Contact your org admin to adjust permissions.

Resource Not Found

HTTP/1.1 404 Not Found
{"error": "Not found"}

Fix: Verify the resource ID. Use supercheck job list, supercheck monitor list, etc. to find valid IDs.

Rate Limited

HTTP/1.1 429 Too Many Requests
Retry-After: 60
{"error": "Rate limit exceeded"}

Fix: The CLI handles this automatically. If hitting limits frequently, consider batching operations or using longer intervals between requests.

Duplicate Token Name

HTTP/1.1 409 Conflict
{"error": "Token name already exists in this project"}

Fix: Use a unique name for the new CLI token.

On this page