Skip to content

Errors

errors

Typed exceptions raised by the Durable Workflow client and worker.

Every exception inherits from :class:DurableWorkflowError, so callers that only want to distinguish SDK errors from unrelated failures can catch that base. More specific subclasses let callers react to particular outcomes — workflow-not-found, update-rejected, schedule-already-exists — without parsing server response bodies.

DurableWorkflowError

Bases: Exception

Base class for every exception raised by the SDK.

ServerError

ServerError(status, body)

Bases: DurableWorkflowError

A server response was an error that does not map to a typed subclass.

The HTTP status is on :attr:status, and the parsed JSON body is on :attr:body when the server returned one.

reason

reason()

Return the machine-readable reason field from the response body, if any.

WorkflowFailed

WorkflowFailed(message, exception_class=None)

Bases: DurableWorkflowError

A workflow finished in the failed state.

:attr:exception_class carries the fully qualified name of the exception class the workflow raised, when the server recorded one.

WorkflowNotFound

WorkflowNotFound(workflow_id)

Bases: DurableWorkflowError

The addressed workflow instance does not exist on the server.

WorkflowAlreadyStarted

WorkflowAlreadyStarted(workflow_id)

Bases: DurableWorkflowError

A start request collided with an existing instance id.

Raised when duplicate-start policy is reject (the default) and the caller-supplied workflow_id is already in use.

NamespaceNotFound

NamespaceNotFound(namespace)

Bases: DurableWorkflowError

The namespace configured on the :class:~durable_workflow.Client is unknown to the server.

InvalidArgument

InvalidArgument(message, errors=None)

Bases: DurableWorkflowError

The server rejected the request as malformed (HTTP 422).

:attr:errors holds the structured validation errors from the response body when the server returned them.

Unauthorized

Unauthorized(message='unauthorized')

Bases: DurableWorkflowError

The request was rejected for missing or invalid authentication (HTTP 401).

ScheduleNotFound

ScheduleNotFound(schedule_id)

Bases: DurableWorkflowError

The addressed schedule does not exist on the server.

ScheduleAlreadyExists

ScheduleAlreadyExists(schedule_id)

Bases: DurableWorkflowError

A create-schedule request collided with an existing schedule id.

QueryFailed

Bases: DurableWorkflowError

A workflow query was rejected or the workflow raised while handling it.

UpdateRejected

Bases: DurableWorkflowError

A workflow update was rejected by the workflow's validator.

ChildWorkflowFailed

ChildWorkflowFailed(message, exception_class=None)

Bases: DurableWorkflowError

A child workflow finished in the failed state.

Raised inside the parent workflow when it awaits the child's result. :attr:exception_class mirrors the child's recorded exception class.

WorkflowTerminated

WorkflowTerminated(message='workflow was terminated')

Bases: DurableWorkflowError

A workflow was terminated by operator action.

Termination is non-gracious and skips normal cleanup, unlike cancellation.

WorkflowCancelled

WorkflowCancelled(message='workflow was cancelled')

Bases: DurableWorkflowError

A workflow was cancelled and finished in the cancelled state.

ActivityCancelled

ActivityCancelled(message='activity was cancelled')

Bases: DurableWorkflowError

An in-flight activity was cancelled.

Raised inside :meth:durable_workflow.ActivityContext.heartbeat when the server reports that the owning workflow has asked for cancellation, so the activity can exit cleanly on its next heartbeat.

NonRetryableError

NonRetryableError(message, *, cause=None)

Bases: DurableWorkflowError

Marker an activity can raise to fail its workflow without further retries.

The server stops retrying the activity and surfaces the failure to the workflow as a terminal activity error, regardless of the configured retry policy.

AvroNotInstalledError

Bases: DurableWorkflowError, ImportError

Raised when the core avro runtime dependency is unavailable.