# Limits & errors

> Concurrency and start limits, request limits, and what each error code means and how to handle it.

## Concurrency

Your plan sets how many sandboxes may be **active** at once (anything not stopped, errored or cancelled). Stopped sandboxes don't count — keep as many as you like (each is kept for 14 days after it last stopped).

| Plan | Active at once |
| - | - |
| $20 / month | 100 |
| $100 / month | 300 |
| $500 / month | 1,000 |
| $2,000 / month | 2,000 |

Going over returns `429 limit_reached`. In an organization, an owner-set cap returns `429 member_limit_reached`.

## Starts

Creates, resumes and forks each count as one **start**, limited per rolling minute, hour and day (see [Billing](/docs/billing#plans) for each plan's numbers). Hitting the minute or hour window returns `429 rate_limited`, and the day window `429 daily_limit_reached`. Both carry a `Retry-After` header and `error.details` with the `window`, the `limit`, how many were `used`, your `planName` and `resetsAt`, when the next start frees up (the windows roll, so that's not midnight). Check what's left before a burst:

```bash
sbx limits --json | jq '.starts'
```

```json
{ "minute": { "limit": 12, "used": 3, "remaining": 9 }, "hour": { "limit": 60, "used": 21, "remaining": 39 }, "day": { "limit": 200, "used": 57, "remaining": 143 } }
```

A `failFast` request that is refused with `no_ready_machine` does **not** count as a start.

## Trials that had already started

There's no free trial for new accounts. A trial that had already started keeps its limits until it ends: 2 sandboxes at once, the `small` and `default` sizes, and auto-stop within 8 hours (`400 trial_auto_stop_required` otherwise). When it ends, it becomes the $20/month plan unless it was cancelled. Cancelling it, or removing its only card, ends it at once and permanently deletes all of the account's sandboxes and snapshots, named snapshots included.

A trial sandbox that uses 90% or more of its vCPUs (averaged per minute) for 30 minutes in a row is slowed to **1 vCPU**. It keeps running, and its memory and disk don't change.

- It applies to that sandbox only.
- The sandbox shows `cpuBraked: {vcpu, since, reason}` (null when it isn't limited), the dashboard marks it "CPU limited during trial", and its events and [webhooks](/docs/webhooks) get `sandbox.cpu_braked`.
- Paying (the plan's first payment, or a time pack) or leaving the trial lifts the limit on all the account's sandboxes at once, with `sandbox.cpu_unbraked`.
- Paid plans are never slowed this way.

## Paid starts above the start limits

On a paid plan, a start limit isn't a wall: starts above it are paid, up to **3x** each limit. Each start above a limit costs, by how far past the limit it falls:

| Start number, against the limit | Price per start |
| - | - |
| Up to 1x | free |
| Above 1x, up to 1.5x | $0.03 |
| Above 1.5x, up to 2x | $0.05 |
| Above 2x, up to 3x | $0.07 |

- The same rule applies to the per-minute, per-hour and per-day limits. A start that's above limits in several windows pays the highest price among them.
- Example on the $20 plan (200 starts a day): 300 starts in one day cost $3, and 600 cost $22. Start 601 is refused. The [pricing page](/pricing#burst-above-your-start-limits) has every plan.
- Paid starts come out of your prepaid credit ([time packs](/docs/billing)), never your plan's included time. Auto-refill also buys a pack when the credit can't pay for the next paid start.
- They need a paid plan and its first payment. Complimentary plans, trials and accounts with only time packs (no plan) don't burst.
- **To never pay for starts**, keep your prepaid credit empty and auto-refill off: starts then stop at the limit as before.

`GET /api/v1/limits` (`sbx limits --json`) shows where you stand:

| Field | What it is |
| - | - |
| `paidStarts` | `{available, reason}`: whether starts above a limit are paid right now, and if not why (`trial`, `comp`, `no_plan`, `no_payment` or `wallet_empty`) |
| `nextStartDollars` | What the next start costs now: `0` inside every limit, `null` when it would be refused |
| `startLimitsWithWallet` | `{perMinute, perHour, perDay}`: your ceilings with paid starts (each limit times 3), or `null` when paid starts aren't available |
| `overagePrices.startBrackets` | The price brackets above, as `{aboveMultiple, upToMultiple, dollars}` |
| `overagePrices.startLimitMultiplier` | `3`: paid starts stop at this multiple of each limit |

A refused start still answers `429 rate_limited` (minute or hour) or `429 daily_limit_reached` (day). `error.details` adds `startLimitsWithWallet`, `paidStartsAvailable` and `paidStartsReason`, and the message ends with why: "Paid starts are off: …" (for example, no prepaid credit) or "You're at 3x your limit, the most paid starts allow."

## Request sizes and timeouts

| Limit | Value |
| - | - |
| Per-sandbox `env` | 100 variables, 64 KB total |
| `setupScript` | 64 KB |
| Synchronous command timeout | 1–600 s (default 30) |
| Command output kept per command | 8 MiB per stream for waiting commands |
| `ttlSeconds` | 1 s – 30 days, or `null` |
| Sandbox name | 120 characters |
| Named snapshot name | 1–63 characters `[a-z0-9-]` |
| API page size | 1–200 (default 100) |

## Request rate

API calls (and hosted MCP calls) are limited to **600 a minute per API key**, or per account when you're signed in to the dashboard or CLI without a key. Short bursts of up to 300 requests at once are fine; the allowance refills at 10 a second. Over it, a call gets `429 rate_limited` with `Retry-After`. This is separate from the [start limits](#starts), which count creates, resumes and forks.

## Error codes

Every error uses the [error envelope](/docs/api#envelopes). Branch on `code`. The common codes are below; [every API error code](/guides/sandboxer-api-error-codes) is listed with an example in our guide.

| Status | `code` | What to do |
| - | - | - |
| 400 | `invalid_json`, `invalid_request`, `invalid_env`, `invalid_timeout`, `invalid_ttl`, `invalid_type`, `invalid_path`, `invalid_setup_script`, `invalid_labels`, `invalid_subdomain`, `invalid_idle_stop`, `invalid_window`, `unknown_environment` | Fix the request; `message` says what's wrong |
| 400 | `type_too_small` | Moving to a smaller size isn't supported yet ([details](/docs/machines#change-size)) |
| 400 | `invalid_require_memory` | `requireMemory` can't be combined with a size change |
| 400 | `trial_auto_stop_required` | On a trial that had already started, sandboxes must auto-stop within 8 hours ([details](#trials-that-had-already-started)) |
| 400 | `no_changes` | The update named nothing to change |
| 401 | `unauthorized` | Check the key |
| 402 | `payment_method_required` | Add a card and pick a plan (dashboard **Billing**) |
| 402 | `payment_past_due` | Your last payment didn't go through: pay the open invoice or update your card in **Billing** (`details.billingUrl`). Running sandboxes keep running |
| 402 | `billing_required`, `trial_expired` | Out of machine time, or an existing trial ended: add credit or pick a plan |
| 402 | `team_member_cap_reached` | You reached the usage cap your organization set |
| 402 | `storage_limit_reached` | Storage is full: delete stopped sandboxes or named snapshots, or upgrade. `details` has `usedBytes` and `includedBytes` |
| 403 | `api_key_action_forbidden`, `api_key_sandbox_forbidden`, `api_key_expired` | Use a key with the right scope |
| 403 | `machine_class_plan_required` | `xlarge` needs a higher plan |
| 404 | `not_found`, `snapshot_not_found` | Check the id; sandboxes of other accounts look like 404s |
| 404 | `file_not_found` | No file at that path in the sandbox (reading or downloading a file) |
| 409 | `machine_not_running` | The sandbox is stopped: resume it first, or wait for `ready` |
| 409 | `sandbox_starting`, `sandbox_stopping` | It's in the middle of starting or stopping: retry in a moment |
| 409 | `sandbox_not_ready` | It can't be forked in its current state; `details.state` says which |
| 409 | `snapshots_disabled` | Created with snapshots off, so it can't be resumed or forked |
| 409 | `confirmation_required` | Deleting needs the `X-Sandboxer-Confirm-Delete` header set to the sandbox id |
| 409 | `name_taken`, `subdomain_taken`, `version_conflict` | Pick another name or subdomain, or re-read the latest snapshot version |
| 409 | `card_check_pending` | Your new card is being checked — retry in a few seconds |
| 409 | `idempotency_in_progress` | Retry with the same key shortly |
| 409 | `idempotency_key_reused` | Use a new key for a different body |
| 409 | `no_running_turn` | Nothing to steer — send a prompt instead |
| 409 | `monitoring_off`, `snapshots_off_for_account` | The feature is off for this sandbox/account |
| 413 | `file_too_large` | The upload is over the size limit |
| 415 | `unsupported_media_type` | Send the `Content-Type` the endpoint expects |
| 429 | `rate_limited`, `daily_limit_reached` | Too many starts, even with [paid starts](#paid-starts-above-the-start-limits) (wait until `details.resetsAt`, also `Retry-After`; add prepaid credit if `details.paidStartsReason` is `wallet_empty`) or too many requests (back off) |
| 429 | `limit_reached`, `member_limit_reached` | Too many running at once: stop sandboxes you don't need |
| 426 | `client_outdated` | That `sbx` or SDK release is known to be broken: update it (`sbx update`, `pip install -U sandboxer-sdk`, `npm i sandboxer-sdk@latest`) |
| 502 | `sandbox_direct_failed` | The machine didn't answer; retry when `details.retryable` is true |
| 503 | `no_ready_machine` | Only with `failFast` — retry or fall back to another size |
| 503 | `capacity_exceeded` | Not enough room right now for this size. `details.available` says how many more fit, and `details.availableBySize` gives the count for each size. Try a smaller size, or again shortly |

## Retrying safely

- Retry `5xx`, `429`, `sandbox_starting`, `sandbox_restoring` and network errors with exponential backoff and jitter (start around 500 ms, cap around 30 s).
- Make creates safe to retry with an `Idempotency-Key` header.
- Never blindly retry `4xx` other than the ones above — the request needs to change.
- Log `requestId` (also the `X-Request-Id` header) with every failure; support can trace it.
