CrowNest
API reference

Errors

The CrowNest API error envelope, the full table of public error codes, and guidance on retries.

Every error response uses a single JSON envelope with a stable, machine-readable code. Branch on the code field, not on the human-readable message, which may change.

Error envelope

All error responses share this shape:

{
  "error": {
    "code": "invalid_request",
    "message": "ttlMs must be a positive integer",
    "details": { "field": "ttlMs" }
  }
}
  • code — lowercase snake_case identifier, stable across releases.
  • message — human-readable explanation, for logs and debugging.
  • details — optional object with extra context, varies by code.

Error codes

These are the error codes you can encounter across the public API:

CodeHTTPMeaning
invalid_request400Malformed request or validation failure
sandbox_ttl_exceeded400Requested ttlMs exceeds your plan limit
reserved_env_key400Env key uses the reserved CROWNEST prefix
unauthenticated401Missing or invalid credentials
invalid_api_key401API key is malformed or revoked
billing_required402Billing configuration required
forbidden403Missing scope or no access to the resource
org_suspended403Organization is suspended
not_found404Resource doesn't exist or isn't visible to your key
conflict409Resource state conflicts with the request
idempotency_key_reused409Same Idempotency-Key with a different request
idempotency_request_in_progress409Original request with this key is still running
sandbox_destroyed410Sandbox is already destroyed
file_too_large413File exceeds the 256 KB direct read/write limit
quota_exceeded429Plan quota reached
rate_limited429Request rate limit reached
command_timed_out500Command exceeded its timeoutMs
stream_gap500Log sequence is outside the retention window
internal_error500Server-side failure
runtime_error500Server-side runtime failure
preview_unavailable502Preview port isn't responding

File operations have additional codes such as path_outside_workspace, file_not_found, and directory_not_empty. See Files for the full list.

[!NOTE] A non-zero command exit code is not an API error. The HTTP request succeeds, and you read the outcome from the Command object's status and exitCode fields.

Handling 4xx errors

A 4xx response means the request itself is the problem. Don't retry the same request unchanged — fix it first:

  • invalid_request, sandbox_ttl_exceeded, reserved_env_key — correct the request body or parameters.
  • unauthenticated, invalid_api_key, forbidden — fix the credential or its scopes. See Authentication.
  • not_found, sandbox_destroyed — the resource is gone or invisible to your key; don't retry.
  • quota_exceeded and rate_limited are the exception: both return 429 and are retryable. For rate_limited, retry after a short backoff. For quota_exceeded, free up capacity (for example, kill idle sandboxes) or upgrade your plan.

Handling 5xx errors

A 5xx response means something failed on the server side. These are generally safe to retry with exponential backoff. For POST endpoints that create or run resources, retry with the same Idempotency-Key so a retry can never duplicate work. See Pagination and idempotency.

command_timed_out is the exception: the command genuinely ran out of time, so retrying the identical request usually times out again. Raise timeoutMs or reduce the work.

Next steps

On this page