Skip to main content
All cwsandbox exceptions inherit from CWSandboxError.

Hierarchy

CWSandboxError
    +-- CWSandboxAuthenticationError
    +-- SandboxError
        +-- SandboxNotRunningError
            +-- SandboxUnavailableError
        +-- SandboxTimeoutError
            +-- SandboxRequestTimeoutError
            +-- SandboxCommandTimeoutError
        +-- SandboxTerminatedError
        +-- SandboxFailedError
        +-- SandboxNotFoundError
        +-- SandboxExecutionError
        +-- SandboxFileError
        +-- SandboxResourceExhaustedError
        +-- SandboxTerminalStateUnavailableError
    +-- DiscoveryError
        +-- RunnerNotFoundError
        +-- ProfileNotFoundError
    +-- FunctionError
        +-- AsyncFunctionError
        +-- FunctionSerializationError

Reference

CWSandboxError

Source: src/cwsandbox/exceptions.py:18 Base exception for all CWSandbox operations. Attributes
  • reason (str | None): Structured error reason parsed from google.rpc.ErrorInfo (e.g. "CWSANDBOX_FILE_NOT_FOUND"), or None when the error did not carry AIP-193 details.
  • metadata (Mapping[str, str] | None): Machine-readable metadata from ErrorInfo.metadata. Empty dict when the error carried no metadata.
  • retry_delay (timedelta | None): Suggested client retry delay parsed from google.rpc.RetryInfo, or None when absent.

CWSandboxAuthenticationError

Source: src/cwsandbox/exceptions.py:51 Raised when authentication fails.

SandboxError

Source: src/cwsandbox/exceptions.py:55 Base exception for sandbox operations.

SandboxNotRunningError

Source: src/cwsandbox/exceptions.py:59 Raised when an operation requires a running sandbox.

SandboxUnavailableError

Source: src/cwsandbox/exceptions.py:144 Raised when the sandbox service is transiently unavailable.

SandboxTimeoutError

Source: src/cwsandbox/exceptions.py:63 Raised when a sandbox operation times out.

SandboxRequestTimeoutError

Source: src/cwsandbox/exceptions.py:154 Raised when a gRPC request exceeded its deadline.

SandboxCommandTimeoutError

Source: src/cwsandbox/exceptions.py:162 Raised when the user’s command inside the sandbox timed out.

SandboxTerminatedError

Source: src/cwsandbox/exceptions.py:67 Raised when a sandbox was terminated externally.

SandboxFailedError

Source: src/cwsandbox/exceptions.py:71 Raised when a sandbox fails to start or encounters a fatal error.

SandboxNotFoundError

Source: src/cwsandbox/exceptions.py:75 Raised when a sandbox is not found (e.g., already deleted). Attributes
  • sandbox_id (str | None): The ID of the sandbox that was not found, or None.

SandboxExecutionError

Source: src/cwsandbox/exceptions.py:95 Raised when command execution fails inside a sandbox. Attributes
  • exec_result (ProcessResult | None): The ProcessResult from the failed execution, or None.
  • exception_type (str | None): Python exception class name from sandbox stderr, or None.
  • exception_message (str | None): Exception message from sandbox stderr, or None.

SandboxFileError

Source: src/cwsandbox/exceptions.py:121 Raised when a file operation fails in the sandbox. Attributes
  • filepath (str | None): The path of the file that caused the error, or None.

SandboxResourceExhaustedError

Source: src/cwsandbox/exceptions.py:171 Raised when the sandbox service is under resource pressure.

SandboxTerminalStateUnavailableError

Source: src/cwsandbox/exceptions.py:179 Raised when the backend does not report a terminal state after stop.

DiscoveryError

Source: src/cwsandbox/exceptions.py:195 Base exception for discovery operations (runners, profiles).

RunnerNotFoundError

Source: src/cwsandbox/exceptions.py:204 Raised when a runner ID is not found. Attributes
  • runner_id (str): The ID of the runner that was not found.

ProfileNotFoundError

Source: src/cwsandbox/exceptions.py:224 Raised when a profile is not found. Attributes
  • profile_name (str): The name of the profile that was not found.
  • runner_id (str | None): The runner ID if specified in the request, or None.

FunctionError

Source: src/cwsandbox/exceptions.py:247 Base exception for function execution operations.

AsyncFunctionError

Source: src/cwsandbox/exceptions.py:251 Raised when an async function is passed to @session.function().

FunctionSerializationError

Source: src/cwsandbox/exceptions.py:259 Raised when arguments, referenced globals, or closures cannot be serialized.
Last modified on May 19, 2026