Limits and errors
This page gives the lifetime of a sandbox instance, per-execution timeouts, file and network bounds, and the sandbox error codes a caller will meet. Every value in the table comes from a constant or a decision in the implementation; the sources are listed below it.
| Limit | Value |
|---|---|
| Default instance lifetime | 5 minutes |
| Continuous running cap | 4 hours, then the instance pauses; an ephemeral one ends instead |
| Retention after pause | 1 minute by default, or unlimited |
| How renewal works | Resets the deadline to now + the requested duration; it does not add to the old value |
| Renewal durations in the console | 15 / 30 / 60 minutes |
| Default connect timeout | 300 seconds |
| Program timeout, default / maximum | 120 s / 600 s |
| Program CPU time cap | 30 seconds, and never more than that run’s timeout |
| Command timeout | Taken from the request; with none given, no server-side default applies |
| Single file read or write | 16 MiB |
| Single file read or write inside the terminal | 10 MiB |
| Stored bytes per instance | 8 GiB |
| Batch write, files / total bytes | 256 / 16 MiB |
| Batch read, paths / total bytes / per file | 256 / 8 MiB / 2 MiB |
| One chunked read or write | 4 MiB |
| File manifest, entries per page / entries total / time budget | 5,000 / 200,000 / 60 s |
| Preview link lifetime, default / maximum | 15 min / 24 h |
| Concurrent operations on one instance | 5 served at once, the rest queue; a queue wait over 30 s returns RATE_LIMITED |
| Hosts in a network allowlist | 64 |
| Labels, entries / key / value | 32 / 128 bytes / 1 KB |
You can renew an instance before it expires: sandbox.instances.renew sets the deadline to now + the requested duration rather than adding to the old one, and sandbox.instances.connect extends it only when now + timeout is later than the current deadline. A program timeout is passed per run, and a request above the maximum is refused with INVALID_PARAMS; the CPU time cap is also bounded by that run’s timeout, whichever comes first. A file read or write transfers at most 16 MiB per call, so larger work uses chunked reads and writes with smaller batches; 8 GiB is what one instance may store, and new writes are refused once it is full.
A command that goes quiet
A foreground command may declare progressTimeoutMs (1000 to 3600000 milliseconds). Once the command has gone that long without writing a single byte to stdout or stderr, the platform ends it and answers COMMAND_NO_PROGRESS (504) with the stdout and stderr received so far (each still bounded to 1 MiB) and lastOutputAt, the moment the last output arrived — null when there never was any. It is off by default: without the parameter a foreground command behaves exactly as before.
- Only the command ends, never the sandbox: the platform sends
SIGTERMto the command and its children, thenSIGKILLto whatever is still alive five seconds later. The sandbox keeps running, and its files, background commands and other sessions are untouched; whether to keep using it is the caller’s decision. - A command that keeps writing is never ended by it: the window restarts on every output, so a slow command that never goes quiet is safe. How long the whole command may take is a separate matter, owned by
timeoutMs; both deadlines apply and whichever comes first wins. - Turn output buffering off first: most programs (Python, many build tools) collect output in a buffer and look silent while they work. Flush per line before using this parameter, for example with
PYTHONUNBUFFERED=1or by wrapping the command instdbuf -oL. - Passing it together with
background: trueis refused: a background command returns at start, so no request is left to end it and the parameter would silently do nothing. That answer isINVALID_PARAMS(400).
Network and packages
Internet access is on by default. It is turned off only by passing allow_internet_access: false, which denies every destination except the hosts listed in network.allowOut; a denied request returns 403, raw TCP connections are always refused, redirects are not followed automatically, and the next hop passes the same check again.
- How many hosts:
allowOuttakes at most 64 entries, written either asapi.example.comor*.example.com(*.example.comdoes not coverexample.comitself). - Egress IP: the default egress IP is not fixed and changes with the machine; a fixed address needs a persistent sandbox with
network.staticEgressIp, see Fixed egress IP. - Installing packages: an Environment installs apt / npm / pip / cargo / gem / go packages from its declared list when it is built. If an Environment declares packages while its networking is limited with package managers disallowed, publishing it is refused with
INVALID_PARAMS. - Running a package manager command in the terminal during a session is not part of the built-in base environment’s command set: such a command is refused with
PROVIDER_UNSUPPORTED. It exits with code 126 and carries a hint to upgrade to a full sandbox, rather than failing silently. - A declared package failing to install terminates the session with the code in the error table below; fix the package list, rebuild the Environment, and create the instance again.
Errors
A command’s exit code is not an error: a non-zero exit is the result itself. The table below covers the codes you meet when a request is refused or an execution fails.
| Code | Meaning | What to do |
|---|---|---|
INVALID_PARAMS (400) | Invalid parameter: a non-positive or over-limit timeout, too many labels, a path that is not absolute; network.staticEgressIp that is not a boolean, or sent for an ephemeral sandbox (no autoPause: true) | Fix that parameter as the message says; do not retry unchanged |
UNAUTHENTICATED (401) | Credentials missing or unrecognized | Check the API key and send the request again |
INSUFFICIENT_BALANCE (402) | The account cannot cover further billing | Top up and retry |
ACCOUNT_SUSPENDED (403) | The account is suspended | Contact support about the account state |
INSTANCE_NOT_FOUND (404) | No such instance: never created, killed, or failed | Create a new instance rather than retrying the old ID |
FILE_NOT_FOUND (404) | The path does not exist | List the directory to confirm the path |
INSTANCE_NOT_RUNNING (502) | The instance is paused or terminated and cannot execute right now | Resume it, then execute |
SANDBOX_EXPIRED (410) | The sandbox’s machine has ended (timeout, retention, provider loss) and its files are gone; the response body carries terminationReason | Create a new sandbox; keep files that must last in File or on a Computer. See two lifecycles for the reason and what to do |
RATE_LIMITED (429) | Operations on one instance queued for over 30 seconds | Retry shortly and lower the concurrency |
PROVIDER_UNSUPPORTED (501) | The current execution environment does not support this command or capability; the E2B-compatible face also returns it for network.staticEgressIp: true | Use a supported command, or upgrade to a full sandbox as the hint says |
PROVIDER_FAILED (502) | The backend failed while executing | Note the instance ID and the request time, then retry; contact support if it persists |
PROVIDER_CAPACITY (503) | The backend has no capacity available right now | Retry shortly |
EXEC_TIMEOUT (504) | A command or program passed its execution deadline | Raise that run’s timeout or split the work; do not retry unchanged |
COMMAND_NO_PROGRESS (504) | A foreground command produced no output for the progressTimeoutMs it declared, so that command was ended; the sandbox keeps running | Check whether the program buffers its output, then decide between retrying and stopping it with DELETE |
ENVIRONMENT_PACKAGE_INSTALL_FAILED | A declared package failed to install and the session ended | Fix the package list, rebuild the Environment, and create the instance again |
Model errors covers codes, authentication and retry policy in general — the same HTTP semantics apply to every service — and the sandbox API reference lists per-endpoint parameters and errors.