Errors
The exception hierarchy and how to handle failures.
Every failure in the Python SDK is raised as DaytonaError or one of its subclasses — named to match the official Daytona SDK so existing error handling ports unchanged. HTTP failures map onto subclasses by status code; client-side failures (validation, timeouts, connection errors) use the same classes.
Hierarchy
All classes are importable from rlp:
| Exception | HTTP status | Raised when |
|---|---|---|
DaytonaError | any / none | Base class; also raised directly for unmapped statuses and generic failures (e.g. a sandbox landing in error). |
DaytonaValidationError | 400 | Invalid input — server-side, or client-side (missing api_url, negative timeout, missing snapshot/image). |
DaytonaAuthenticationError | 401 | Authentication failed, including a missing API key at client construction. |
DaytonaAuthorizationError | 403 | Request forbidden. |
DaytonaNotFoundError | 404 | Resource not found. |
DaytonaConflictError | 409 | Resource conflict — e.g. deleting a volume that is still attached. |
DaytonaRateLimitError | 429 | Rate limit exceeded. |
DaytonaNotSupportedError | 501 | Operation not supported — e.g. stop()/pause()/fork() on a non-persistent sandbox, or archive(). |
DaytonaTimeoutError | — | An HTTP request or a wait (e.g. wait_until_started) timed out. |
DaytonaConnectionError | — | The network connection failed. |
Every instance carries three attributes:
| Attribute | Type | Description |
|---|---|---|
message | str | Human-readable message (from the API's error body when available). |
status_code | int | None | HTTP status, when the error came from a response. |
error_code | str | None | Machine-readable code from the API body, when present. |
Patterns
Handle a create timeout by inspecting and cleaning up the sandbox:
Retry on rate limits:
Branch on capability — persistent-only operations raise DaytonaNotSupportedError locally:
Detect a spot-evicted sandbox: eviction pauses a persistent spot sandbox (or deletes an ephemeral one), so a stopped persistent spot sandbox can simply be started again. See spot sandboxes.