Skip to Content
SDKErrors

Errors

TL;DR

Relay, core, and transport failures normalized by the SDK are CmdopError instances with a stable code, message, retryability flag, optional HTTP status, and optional redacted details.

Local usage and client-invariant failures can be plain Error instances. For example, this includes an invalid timeout or limit, an empty ask without an attachment, and an unexpected response shape. Use CmdopError as the base class for normalized operational failures, not as a catch-all for every JavaScript or Python exception.

Hierarchy

TypeMeaning
AuthErrorCredentials are missing or invalid.
PermissionErrorThe caller is authenticated but not permitted.
NotFoundErrorThe requested machine or resource was not found.
ConflictErrorThe request conflicts with current state.
ValidationErrorAn input is invalid.
RateLimitErrorThe relay is rate limiting the caller.
ServerErrorThe relay or core failed internally.
ConnectionErrorThe core process or transport failed.
TimeoutErrorA deadline expired; this error is retryable.
UnavailableErrorThe relay is reachable but the target is unavailable.
UnsupportedErrorThe requested capability is unsupported.
ProtocolErrorA protocol contract was violated.
AgentStreamErrormachines.ask().collect() reached an unsuccessful terminal outcome.

Handle errors

from cmdop import CmdopError, UnavailableError try: history = await client.machines.messages(machine_id, limit=100) except UnavailableError: print("Machine is unavailable") except CmdopError as error: print(error.code, error.status, error.retryable)
import { CmdopError, UnavailableError } from "@cmdop/sdk"; try { const history = await client.machines.messages(machineId, { limit: 100 }); } catch (error) { if (error instanceof UnavailableError) console.log("Machine is unavailable"); else if (error instanceof CmdopError) { console.log(error.code, error.status, error.retryable); } }

Retry only when retryable is true and the operation is safe for your application to repeat.

Last updated on