> ## Documentation Index
> Fetch the complete documentation index at: https://docs.styne.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Errors

> Read the error body of a failed call to see its code, who caused it and whether to retry.

Every failed call answers a JSON body with the same fields, and the same envelope is the last line of a stream that fails
after it started. Quote `request_id` (also the `x-request-id` response header) when you write to [support@styne.ai](mailto:support@styne.ai).

```text theme={"theme":"css-variables"}
{"code": 404, "error_code": "not_found", "message": "sandbox 'vm0123' not found", "origin": "client", "request_id": "d519af09-8dbb-4d1f-8a2f-9a42698cbe16"}
```

| Field | Meaning |
| - | - |
| `code` | the HTTP status, as a number |
| `error_code` | the stable machine-readable code from the table below; branch on this, not on `message` |
| `message` | a sentence for a person; it can change. It never carries internal values of the service |
| `origin` | who caused it, see [origin](#origin) |
| `request_id` | the id of the call |
| `evidence` | structured details for some codes (a timeout in milliseconds, a limit and its value) |

A `429` or `503` carries a `Retry-After` header in seconds, except a quota such as `quota_exceeded`. Wait that long before the next try.

## Origin

`origin` says who caused the failure, so an eval or RL harness can tell a failed rollout from a failed platform. It is
set only from evidence the service holds (the status, a typed refusal, the node's own report), never guessed from the
message.

| `origin` | Meaning | What a harness does |
| - | - | - |
| `client` | the request itself: malformed, unauthorised, a missing sandbox, a call that does not fit the sandbox's state | fix the call |
| `customer_limit` | a limit of the account or one you set was reached: a plan limit (`422`, `429`), a suspension or throttle, the sandbox's `timeout`, an exec's `timeoutMs`, an eviction for what the sandbox did (`endReason` `evicted`, `endDetail` naming `cpu_hog`, `fork_flood`, `io_hog` or `egress_flood`) | not a platform failure; raise the limit or the timeout |
| `infrastructure` | the platform: no capacity, a node out of memory or addresses, a node that cannot be reached or was lost, a route the node does not serve | retry; do not score the rollout |
| `guest` | the program run in the sandbox, when the node can tell | score it as the run's own outcome |
| `agent` | the sandbox's guest agent stopped serving while the VM ran (often because of what ran in the guest, for example memory) | score it as the run's own outcome, or retry if it repeats |
| `unknown` | no component reported evidence either way (a node that did not answer in time, an internal error of no known cause) | retry once; quote `request_id` if it repeats |

A command killed at its `timeoutMs` is `customer_limit` even on a busy node: the limit you set was reached, and the
service does not report why the command was slow.

## Codes

| Status | `error_code` | Meaning and what to do |
| - | - | - |
| 400 | `invalid_argument` | the request is malformed: a missing `templateID`, a `timeout` outside 1 to 86,400, an unknown field, an unknown pause tier, or an exec of a program or user that does not exist in the sandbox. The `message` names the field or the program. Fix the request; do not retry it unchanged. |
| 401 | `unauthenticated` | the key is missing or wrong (`missing api key`, `invalid api key`). See [API keys](https://docs.styne.ai/authentication.md). |
| 403 | `permission_denied` | the key may not do this. |
| 403 | `account_suspended` | the account was blocked for abuse. Its sandboxes are paused and their files are kept; nothing was deleted. The body adds `reason` (a machine code), `support` (where to write) and `kept`. Do not retry: write to the address in the body to have the account reviewed and restored. |
| 404 | `not_found` | no such sandbox or template for this account. A sandbox of another account answers the same, so ids do not leak. |
| 404 | `unknown_route` | the path is not a route of this API. Under a drop-in path (E2B, Daytona, boat and the others) the message names the docs page that lists that family's routes. |
| 402 | `no_credit_stopped` | the account has no credit; new starts and resumes are refused until it has a plan or balance, and its data is kept for 7 days, see [Plans and billing](https://docs.styne.ai/billing.md#when-an-account-has-no-credit) |
| 402 | `plan_required` | the account has no trial or plan; see the refusals below. Any other `402` is `payment_required`. |
| 405 | `method_not_allowed` | the route exists, the method does not. |
| 409 | `already_paused` | a pause of a sandbox that is already paused. Nothing changed; carry on. |
| 409 | `already_running` | a resume of a sandbox that is already running. Nothing changed; carry on. |
| 409 | `conflict` | another state conflict: a snapshot name that already exists, an `Idempotency-Key` whose first request is still running, or another lifecycle call on the same sandbox in flight. Retry after that call ends. |
| 412 | `sandbox_paused` | the sandbox is paused and the call needs it running (an exec, for example). Resume it, or create it with `autoResume`. |
| 412 | `failed_precondition` | the sandbox is not in a state that takes this call; the `message` says why. |
| 410 | `sandbox_ended` | the sandbox was killed. The body adds `sandboxID`, `state: "killed"`, `endReason` and, when known, `endedAt`. |
| 410 | `sandbox_timeout` | the sandbox reached its timeout; `evidence.timeout_ms` is the timeout it had. |
| 410 | `node_loss` | the node that held the sandbox was lost; `evidence.event_id` names the event. Create a new sandbox. |
| 410 | `agent_exit` | the guest agent stopped serving while the VM ran; `endDetail` can carry its reason. |
| 422 | `unknown_region` | the create named a `region` that is not a region id or an alias. See [Regions](https://docs.styne.ai/regions.md). |
| 422 | `snapshot_region_mismatch` | a create started a snapshot in another region than the one it is kept in. Leave `region` out. See [Regions](https://docs.styne.ai/regions.md). |
| 404 | `volume_not_found` | a create named a volume the account does not have, or a volume call named one. |
| 409 | `name_taken` | a volume with that name exists already. |
| 202 | `image_building` | the image a create named is being prepared. Repeat the create. See [Container images](https://docs.styne.ai/images.md). |
| 404 | `image_not_found` | the registry has no such image repository, tag or digest. |
| 422 | `image_registry_not_allowed` | the image is on a registry other than `docker.io`, `ghcr.io` or `quay.io`. |
| 429 | `image_build_rate_limited` | the account asked for too many new images this hour, or too many images wait to be prepared. |
| 409 | `volume_busy` | the volume is mounted in another sandbox (`volume is attached to sandbox <id>`): a delete or a create is refused at once. Kill that sandbox, or retry. |
| 409 | `volume_mounted` | a pause, snapshot, fork or rewind of a sandbox that has a volume mounted. Volumes stay with the sandbox that mounted them; kill it and mount the volume in a new one. |
| 409 | `volume_node_mismatch` | the volumes (and snapshot) of one create are kept on different machines. Mount volumes kept together. |
| 422 | `volume_region_mismatch` | a create named another region than the one its volume is kept in. Leave `region` out. See [Regions](https://docs.styne.ai/regions.md). |
| 500 | `volume_mount_failed` | the guest could not mount the volume; the sandbox was not created and the volume is free again. Retry. |
| 503 | `region_unavailable` | no machine in the asked region is taking new VMs now. Retry after `Retry-After`, or choose the other region. |
| 422 | `class_not_served` | the create named a `class` other than `burstable` or `guaranteed`. |
| 402 | `guaranteed_needs_paid` | `class: "guaranteed"` is for paid accounts. Add a card, or leave `class` out. |
| 503 | `guaranteed_capacity` | no node has whole cores free for a guaranteed sandbox right now. Retry after `Retry-After`, or leave `class` out. |
| 429 | `quota_exceeded` | a limit of your plan: `evidence.limit` `concurrency_target` when the account already runs as many sandboxes as it is entitled to (`granted`, `target` and `live` are in the body). Wait for `Retry-After`, or end a sandbox. |
| 429 | `capacity_provisioning` | you are entitled to more concurrent sandboxes than you hold now and capacity is being added; the body has `granted`, `target`, `live` and `eta_seconds`. Retry after `Retry-After`. |
| 429 | `account_throttled` | the account sent far more than its tier's usual traffic and is held to a low rate until the traffic ends. The body adds `reason` and `support`; `Retry-After` is when the current minute's allowance renews. The limit lifts by itself a few minutes after the traffic stops: back off and retry; write to support if the traffic is expected. |
| 429 | `resident_limit` | a create would take the account past a ceiling of its tier on what it keeps resident. The body names `limit` (`resident_sandboxes`, `resident_vcpu` or `resident_memory_mib`), `used`, `maximum`, `tier` and `upgrade`. It is a quota: archive or kill sandboxes to free room (a kill, a delete or a browser removal frees it at once), or follow `upgrade`; repeating the create unchanged fails again. `maximum` is `caps.max_resident_sandboxes` of `GET /v1/run/usage`. |
| 429 | `storage_limit` | the account would keep more stored than its tier allows. The body names `limit` (`held_sandboxes`: sandboxes held in any state, paused to disk included, checked on create and fork; `snapshots`: saved snapshots and checkpoints; `snapshot_gib`: the GiB they hold, both checked before a snapshot is taken); `written_gib`: the GiB your running sandboxes on one node have written to their disks, checked on create, fork and resume, see [limits](https://docs.styne.ai/limits.md#disk-written-per-node)), `used`, `maximum`, `tier` and `upgrade`. It is a quota: kill paused sandboxes or delete snapshots you no longer need (`DELETE /snapshots/{name}`), or follow `upgrade`; repeating the call unchanged fails again. |
| 502 | `agent_exit` | a call reached a sandbox whose guest agent had stopped; `origin` is `agent`. |
| 502 | `upstream_error` | the node answered with an internal failure. Retry once; quote `request_id` if it repeats. |
| 503 | `capacity` | no node could take the create right now. Retry after `Retry-After`. |
| 503 | `egress_unavailable` | `POST /browsers` with an `egress` whose route could not open a connection within 15 s; the session it claimed is closed. The body adds `egress` (the route asked for), `cause` (`upstream_provider_refused` with the provider's `upstream_status`, `upstream_provider_failed`, `exit_unreachable` or `no_answer`) and `origin` `infrastructure`. Retry after `Retry-After` (60 s after a provider refusal), or create the session with another `egress`. |
| 503 | `upstream_unavailable` | the node of the sandbox could not be reached, its guest agent did not answer, or the node is being updated to a newer build. Retry after `Retry-After` (1 s). |
| 503 | `resource_exhausted` | the node or the sandbox is out of a resource. Retry after `Retry-After`. |
| 504 | `deadline_exceeded` | the node did not answer in time. |
| 504 | `command_timeout` | an exec ran past its `timeoutMs` and was killed; it arrives as a line of the stream, see [exec](https://docs.styne.ai/exec.md). |

## Plan and limit refusals

These answers carry an extra `error` field naming the rule, and `message` says it in words. For a `402` the `error_code`
is the same name as `error`.

| Status | `error` | Meaning |
| - | - | - |
| 402 | `plan_required` | the account has no trial or plan yet; start the 7-day trial in the dashboard, see [Plans and billing](https://docs.styne.ai/billing.md) |
| 422 | `limit_hours` | the trial's included hours are used up; upgrade to keep going, see [Plans and billing](https://docs.styne.ai/billing.md) |
| 429 | `limit_concurrent` | your plan's number of VMs or browsers at once is reached; end one or wait, `Retry-After` says when to try again |
| 429 | `limit_rate_minute`, `limit_rate_hour`, `limit_rate_day` | your plan's number of new VMs or browsers per minute, hour or day is reached; retry after `Retry-After` |
| 422 | `invalid_argument` | a field this endpoint does not serve or read, for example `volumeMounts` or a misspelled field on create |

## Retrying

Retry `429` (except the quotas `quota_exceeded`, `resident_limit` and `storage_limit`), `503` and `504` after `Retry-After` (or one second when it is absent) with a growing delay. A refused
create holds nothing, so repeating it is safe. Do not retry `400`, `401`, `403`, `404`,
`410` or `412` unchanged. A command that was running when a call failed may still be running: look before you start it
again.

## The E2B SDKs

The unmodified E2B SDKs raise their own exceptions for these answers: a `401` is `AuthenticationException`, a `404`
`NotFoundException` and a `503` `ServiceBusyException`, which are not subclasses of `SandboxException` in the Python
SDK, so catch them by name. `Sandbox.kill()` returns `False` only on `404`; the `410` of an ended sandbox raises.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.