Skip to main content
Every failure the SDK raises is a ZodeError or one of its subclasses. API errors keep the API’s HTTP status and its stable code.
A command that exits non-zero is not an error: exec returns its result. Only check: true and the file helpers turn a failed command into a CommandError.

Classes

status is the HTTP status. It is 0 when the error did not come from an HTTP answer.

Errors with status 0

These come from the SDK, not from an API answer: A timeout or network_error on a create does not tell you whether the sandbox was made. List sandboxes before you try again.

API error codes

The API answers errors as {"error": {"code": "...", "message": "..."}}. The message is for people and may change; branch on code. If the body has no code, the SDK uses http_error. The set of codes is open: the API adds new ones over time. The table lists the ones you are most likely to meet; the Error schema in the API reference lists them all. Handle a code you do not recognise by its status. waitUntilRunning also throws invalid_state with status 409 when the sandbox it polls is stopped, failed or deleted. That one is raised by the SDK.

Retry on capacity errors

no_capacity, node_full and rate_limited clear on their own. Retry them with a growing delay. Do not retry concurrency_limit, daily_cap_reached or credit_exhausted in a loop: they clear only when you stop a sandbox, the cap changes or someone adds a card or credit.
The API sends Retry-After and X-RateLimit-* headers with a rate_limited answer, but the SDK does not expose response headers. The wait is also in the error message.