Sandbox SDK
SDK Reference

Errors

Handle stable error categories while retaining each provider's native cause.

Handling errors

errors.ts
import { isSandboxError } from "@opencoredev/sandbox-sdk";

try {
  await sandbox.run("work");
} catch (error) {
  if (isSandboxError(error) && error.retryable) {
    console.error(error.code, error.operation);
  }
}

Every SandboxError includes code, provider, optional operation, retryable, and the original provider error in cause.

Error codes

CodeRetryable by defaultMeaning
authenticationNoCredentials are missing or invalid.
permissionNoThe credential or account cannot perform the operation.
not_foundNoA sandbox, file, snapshot, or other resource does not exist.
timeoutYesAn operation exceeded its time limit.
rate_limitedYesThe provider rejected work because of a rate limit.
unavailableYesThe provider service is temporarily unavailable.
unsupportedNoThe selected adapter does not support the operation.
invalid_inputNoAn argument or path failed SDK validation.
conflictNoThe requested state conflicts with an existing resource.
terminatedNoThe sandbox or process has already terminated.
process_failedNoA process-level operation failed.
internalNoThe provider failure did not match a more specific category.

Messages redact credential-shaped values and sensitive URLs. Inspect cause for provider-specific diagnostics without coupling control flow to native error text.

Use Capabilities to avoid unsupported operations.

On this page