Errors
Errors share one format. Branch on code, not on the message text.
{
"ok": false,
"type": "sandbox.error",
"status": 409,
"code": "sandbox_resuming",
"message": "The sandbox is resuming.",
"error": { "code": "sandbox_resuming", "message": "...", "status": 409, "details": { "retryable": true } },
"requestId": "req_01HX..."
}
Quote the requestId when you contact support. Every 429 carries a Retry-After header in seconds. Where error.details.retryable is present it tells you whether a retry can help. The edge in front of the API may answer with the same format (type kabin.error) for authentication failures, rate limits and capacity.
| Status | Codes | What to do |
|---|---|---|
| 400 | invalid_json, invalid_query, invalid_path, invalid_timeout, invalid_ttl, invalid_env, invalid_name, invalid_key, invalid_files, type_too_small, count_requires_from, trial_auto_stop_required, invalid_amount | Fix the request. invalid_query names the offending parameter and lists the accepted ones. |
| 401 | unauthorized | Missing, invalid, revoked or expired key. Repeated failures from one address are rate limited. |
| 402 | billing_required, subscription_required | Included time and wallet are used up, or the account has no plan. Pay or subscribe, see billing. |
| 403 | trial_machine_class_not_allowed, trial_saved_snapshots_not_allowed, plan_machine_class_not_allowed, api_key_action_forbidden, api_key_sandbox_forbidden, org_suspended | The plan or key does not allow it, or the account is suspended (contact support). Do not retry unchanged. |
| 404 | not_found, snapshot_not_found | Unknown or inaccessible resource; the answer is the same for both cases. Refresh your state. |
| 409 | sandbox_not_ready, sandbox_starting, sandbox_resuming, sandbox_stopping, invalid_confirm, save_in_progress, snapshot_data_expired, idempotency_in_progress, idempotency_key_reused, api_key_expired, card_required, requires_active_plan | Depends on the code: sandbox_starting, sandbox_resuming, sandbox_stopping and idempotency_in_progress are transient (retry after Retry-After); sandbox_not_ready means the sandbox is in error or cancelled; the others need a changed request. |
| 413 | file_too_large | Use a smaller file; error.details has the limit. |
| 429 | rate_limited, limit_reached, trial_compute_limit_reached, IP_RATE_LIMIT_EXCEEDED | Wait Retry-After. rate_limited also carries nextStartAt, the window and what remains. |
| 500 | internal_failed | Retry idempotent calls with jitter; report persistent failures with the requestId. |
| 502 | sandbox_direct_failed | Retry only when error.details.retryable is true. |
| 503 | out_of_capacity | The platform is full. Retry after retryAfterSeconds (Retry-After). |
Retry guidance
- Send an
Idempotency-Keyon create and fork so a retry cannot create a second sandbox. - Back off exponentially with jitter on
429,500,502(when retryable) and503; honourRetry-After. - Never retry
4xxresponses unchanged, except the transient409codes above.