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

# Understand API results and errors

> Distinguish API envelopes from process outcomes, interpret every stable ErrorCode and LimitDimension, and respect HTTP 429 retry backoff.

Read a Deepest response in two steps: first check the API envelope (`ok`, `retry`, `error.code`), then inspect the operation-specific `result`. A network timeout is not proof that nothing happened, and `ok: true` on `exec` is not proof that the guest program exited `0`.

`@deepest/sdk` preserves valid envelopes untouched and **never retries automatically**.

## Success and failure envelopes

```json Success (Exec) theme={null}
{
  "ok": true,
  "resource_id": "<COMPUTER_ID>",
  "retry": "no-retry",
  "result": {
    "stdout": "Deepest ready\n",
    "stderr": "",
    "exit_code": 0,
    "timed_out": false,
    "output_truncated": false
  }
}
```

```json Failure (LIMIT_EXCEEDED) theme={null}
{
  "ok": false,
  "resource_id": "<COMPUTER_ID>",
  "retry": "no-retry",
  "error": {
    "code": "LIMIT_EXCEEDED",
    "message": "Account persistent Computer limit reached; Stopped Computers still count, so explicitly Delete an unneeded Computer to free a slot.",
    "limit": { "dimension": "persistent_computers", "scope": "account" }
  }
}
```

Always branch on `error.code`, `retry`, and structured fields like `error.limit` or `error.retry_after_seconds`—never parse prose inside `error.message`. Omitted optional fields mean absent/unknown, never `0` or success.

## Three retry dispositions

| Value | Meaning | Safe caller behavior |
| - | - | - |
| `safe` | Explicit later retry is permitted (typically rejected before dispatch) | Wait for any `retry_after_seconds` and fix transient conditions, then retry only the needed call |
| `query-first` | Physical effect is uncertain | Query the original object and concrete task effect before another mutation; keep original intent |
| `no-retry` | Do not mechanically replay this completed action or unchanged invalid request | On failure, resolve the underlying cause; on success (`exec`, `restore`), proceed from the result |

## `UNKNOWN` is an outcome boundary

The control API returns `UNKNOWN` with HTTP `502` and `retry: "query-first"`. The SDK also emits `UNKNOWN` on transport loss or malformed responses (where no HTTP status may exist).

Preserve the original `resource_id`, target ID, and `idempotency_key` (where supported). Note that `resource_id: "request"` is a fallback identifier when creation lacked a known Machine ID—never a Computer ID. Observing `state === "running"` resolves lifecycle state, not whether an arbitrary command sent an external request; check task-specific effects separately. See [Reliability and recovery](https://docs.deepest.dev/api-and-sdk/reliability.md).

## Limits (`LIMIT_EXCEEDED` and quota errors)

`LIMIT_EXCEEDED` returns HTTP `409` (`retry: "no-retry"`). Inspect `error.limit.dimension` and `error.limit.scope`:

| Dimension | Scope | What it measures & how to recover |
| - | - | - |
| `memory` | `account` | Configured running Memory pool; stop unneeded running Machines, pick smaller Memory (256 MiB steps), or upgrade |
| `persistent_computers` | `account` | Retained persistent Computers on the Account (**50 / 500 / 1,000 / 1,000** across Starter / Pro / Max). Stopped, reserved, and pending Computers still count—explicitly **Delete** unneeded Computers to free a slot (Sandboxes are separate) |
| `reserved_intents` | `account` | Undispatched Computer, Sandbox, or Snapshot creation intents; resolve existing pending/reserved work first |
| `share_records` | `account` | Retained Share records (including recently expired/revoked entries until cleanup) |
| `secret_grants` | `machine` | Saved Vault Secret grants on that specific Computer or Sandbox (up to 16) |

* **`STORAGE_LIMIT_EXCEEDED` (409):** Product Storage `used >= limit`. Blocks Create, Clone, and Snapshot, while still permitting existing Computer Start for cleanup (subject to eligibility and Memory). See [Storage Reclaim](https://docs.deepest.dev/computers/storage-reclaim.md).
* **`SANDBOX_NOT_ENABLED` (403):** Account entitlement does not include Sandboxes (for example on Starter). Reducing Memory size does not bypass this.
* An empty `machine_count_constraints` list in `resources.get()` means no numeric limit is currently reported—not unlimited commercial or physical capacity.

## HTTP 429 rate & contention errors

All three HTTP `429` responses share `retry: "safe"`, an HTTP `Retry-After` header, and an equal JSON `error.retry_after_seconds` integer. **No action was dispatched:**

| Error code | Scope & cause | Safe caller action |
| - | - | - |
| `EXEC_BUSY` | Shared Account command concurrency (Computer/Sandbox Exec, Tools install/inspect, Desktop setup) | Wait at least `retry_after_seconds`; retry only the refused command if still needed. Additional Machines do not multiply slots |
| `LIFECYCLE_BUSY` | Shared Account lifecycle contention on Create, Delete, Start, Stop, Resize, Clone, Snapshot Create/Delete/Restore, Storage Reclaim, or Sandbox Create/Delete/Start/Stop | Wait at least `retry_after_seconds`; retry only the refused step with the exact same inputs and original `idempotency_key` where supported |
| `RATE_LIMITED` | Bounded rate protection on public/Human actions such as `invites.redeem` (applied before code lookup or claim) | Wait at least `retry_after_seconds` before the next explicit human attempt |

> [!TIP]
>
> HTTP `429` responses reflect pre-dispatch contention or rate protection—they are **not** a published requests-per-minute quota, and they never justify building an unbounded automatic retry loop.

## Complete stable error families

Always inspect `retry` on every response. The actions below guide investigation rather than replacing `retry` semantics:

| Code | HTTP | Typical action |
| - | -: | - |
| `UNAUTHORIZED` | 401 | Check Bearer token, credential kind (Agent Key vs Human-only), or session validity |
| `AUTH_UNAVAILABLE` | 503 | Human session verification failed before dispatch; retry safely after recovery |
| `NOT_FOUND` | 404 | Verify exact resource ID and Account; never probe across accounts |
| `INVALID_REQUEST` | 400 | Fix input fields, 256 MiB Memory units, or identifier format per API Reference |
| `LIMIT_EXCEEDED` | 409 | Inspect `error.limit.dimension` (`memory`, `persistent_computers`, `reserved_intents`, `share_records`, `secret_grants`) |
| `ENTITLEMENT_REQUIRED` | 403 | Read `resources.get()` and restore active entitlement |
| `ENTITLEMENT_PENDING` | 409 | Previous expiry/cleanup is still settling before redemption; re-read Resources |
| `INVITE_UNAVAILABLE` | 404 | Request a valid code from the issuer; invalid, revoked, exhausted, and used codes share this response |
| `SANDBOX_NOT_ENABLED` | 403 | Account lacks Sandbox entitlement (Starter excludes Sandboxes); use an eligible plan or Computer |
| `IDEMPOTENCY_CONFLICT` | 409 | Reused `idempotency_key` with mismatched payload or source; recover original intent |
| `NOT_RUNNING` | 409 | Observe the Machine and explicitly Start if appropriate |
| `EXEC_BUSY` | 429 | Pre-dispatch command contention; wait `retry_after_seconds` and retry explicitly |
| `LIFECYCLE_BUSY` | 429 | Pre-dispatch lifecycle contention; wait `retry_after_seconds` and retry explicitly with original key |
| `RATE_LIMITED` | 429 | Pre-lookup rate limit (e.g., invite redemption); wait `retry_after_seconds` |
| `EXEC_FAILED` | 502 | Command dispatch/execution infrastructure failed (distinct from nonzero guest exit code) |
| `UNKNOWN` | 502 | Uncertain physical outcome (`query-first`); inspect original object and concrete effect before mutating |
| `RUNTIME_UNAVAILABLE` | 502 | Host/runtime capacity unavailable (`safe`); preserve original asset and retry deliberately later |
| `INTERNAL` | 500 | Preserve request context and follow returned `retry` guidance |
| `TOOL_NOT_SUPPORTED` | 422 | Check `/v1/tools` catalog and `quickInstall` support |
| `TOOL_FAILED` | 502 | Inspect `error.details` (`ToolOutcome`) and `computer(id).tools.inspect()` before retrying install |
| `PREVIEW_UNAVAILABLE` | 502 | Verify Guest web server is listening on `127.0.0.1:<port>` |
| `DESKTOP_UNAVAILABLE` | 502 | Re-observe original Computer and Desktop readiness |
| `DESKTOP_UNSUPPORTED` | 422 | Check supported Debian/Ubuntu Developer Image prerequisites |
| `STORAGE_LIMIT_EXCEEDED` | 409 | Clean disposable files/snapshots and run Storage Reclaim |
| `STOPPED_REQUIRED` | 409 | Save work and explicitly Stop the target Computer first |
| `RESIZE_UNSUPPORTED` | 422 | Check supported Memory increments/transitions; use stopped Resize where required |
| `RESOURCE_CONFLICT` | 409 | Observed dependency or active-entitlement conflict (distinct from `UNKNOWN`); inspect dependencies |
| `STORAGE_RECLAIM_UNSUPPORTED` | 422 | Preserve disk; layout does not support reclaim |
| `STORAGE_RECLAIM_INSUFFICIENT_SPACE` | 409 | Free workspace or add capacity; repeating unchanged will not succeed |
| `STORAGE_RECLAIM_FAILED` | 502 | Disk preserved; inspect original Computer and Storage before contacting Support |
| `VAULT_UNAVAILABLE` | 503 | Secret custody unavailable; do not paste raw secrets into the Guest as a workaround |

Runtime URLs return HTTP statuses directly rather than control-API envelopes—for example, Share returns `410` for expired/revoked links, `409` for a stopped Computer, and `503` when the Guest service is unreachable. Diagnose runtime URLs with [Share](https://docs.deepest.dev/network/share.md).

## Inspect process results and record evidence

* **Exec:** Inspect `exit_code`, `timed_out`, and `output_truncated`. A nonzero exit or timeout can still have written partial files or triggered external calls.
* **Resize & Vault:** Check `disposition` (`live`, `next_start`, `restart_required`).
* **Tools:** Inspect `status` and `error.details`; installation never guarantees third-party authentication.
* **Support reports:** Record timestamp, operation, original Machine ID, `idempotency_key` (if any), `error.code`, `retry`, and minimal non-secret observations. Always redact Agent Keys, Human tokens, invite codes, runtime URLs, and Secret values.


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