Skip to main content
Find out what went wrong and choose the next safe step. These examples handle rejected requests, missing computers, and operations whose outcome is uncertain.
Use Celesto 0.1.7 or later for the structured fields below:

Catch cloud errors

handle_errors.py
The with block deletes the computer when it exits. A nonzero command exit code is a CommandResult, so check result.exit_code. If your code and deletion both fail, Python raises an exception group containing both failures.Missing credentials and invalid local arguments can raise ValueError before a request is sent. Set CELESTO_API_KEY, pass api_key=, or run celesto auth login to supply credentials.

Choose the next action

Read the message first. Use code to distinguish failures that share an HTTP status, especially HTTP 429:

Handle an uncertain outcome

A timeout or unreadable response can happen after the server accepts a request. The SDK does not automatically repeat state-changing requests.
  • Create: inspect your computers in the dashboard before creating another. idempotency_key is a support reference for reconciling that request; the public constructor does not accept it to replay creation.
  • Run a command: check the command’s intended result before running it again. A computer’s running state cannot establish whether the command executed.
  • Stop or resume: inspect that computer’s state before retrying the same operation. Stopping preserves files; deleting removes the computer.
  • Delete: inspect whether that computer still exists before deciding whether to retry deletion on the same handle.
  • Publish or remove a port: inspect computer.published_ports() before repeating the change.

Structured fields

Both CloudAPIError and CloudOperationError expose the common fields below. Optional references are None when no safe value is available. The final three fields apply to CloudAPIError only; validation_errors is an empty tuple when no safe field errors are available. Raw response bodies and connection credentials are excluded. For supported endpoints, CloudAPIError.details["detail"] preserves a bounded HTTP 400 explanation for compatibility. Other arbitrary server diagnostics are excluded.
Last modified on October 22, 2026