All SDK exceptions inherit from SandboxException, which inherits from the built-in Exception. You can catch the base class to handle any Declaw error, or catch specific subclasses for granular handling.
Exception hierarchy
SandboxException
Base class for all Declaw exceptions.
Attributes
TimeoutException
Raised when an operation exceeds its configured timeout.
Inherits sandbox_id from SandboxException.
NotFoundException
Raised when the sandbox or a requested resource does not exist (HTTP 404).
AuthenticationException
Raised when the API key is missing or invalid (HTTP 401/403).
InvalidArgumentException
Raised when a method receives an argument that fails validation.
NotEnoughSpaceException
Raised when the sandbox filesystem is full and a write operation fails.
CommandExitException
Raised when a command exits with a non-zero exit code. Contains the full stdout, stderr, and exit code.
Attributes
CommandExitException is only raised by CommandHandle.wait(). The main
sbx.commands.run() method returns a CommandResult with a non-zero
exit_code rather than raising — you must check result.exit_code yourself
unless you use a background handle.
TemplateException
Base class for template-related errors.
BuildException
Raised when a Template.build() call fails.
FileUploadException
Raised when uploading a file to the sandbox fails (e.g. network error during multipart upload).
GitAuthException
Raised when git operations inside the sandbox fail due to authentication errors.
GitUpstreamException
Raised when git operations fail due to upstream repository errors.
InsufficientBalanceException
Raised when the account has insufficient balance to start or continue a
sandbox operation (HTTP 402).
Attributes
RateLimitException
Raised when the account exceeds its rate limit (HTTP 429). Inspect
retry_after and back off before retrying.
Attributes
Catching all Declaw errors
Retry patterns
Simple retry with backoff
Retry with tenacity
Handle non-zero exit codes
Async error handling