Worker SDK errors

The worker SDK distinguishes three kinds of errors. Picking the right one is the difference between a workflow that retries gracefully and one that retries forever.

Temporary errors

Use worker.TemporaryError for failures you expect to recover on retry — network blips, rate limits, transient downstream outages.

return nil, worker.NewTemporaryError("rate limited", err)

Mobius will retry these per the workflow's retry policy.

Permanent errors

Use worker.PermanentError for failures that won't get better on retry — invalid input, authorization failures, missing resources.

return nil, worker.NewPermanentError("user not found", err)

Mobius will not retry. The step fails immediately.

Timeout errors

Use worker.TimeoutError when you've detected your own deadline being exceeded. The SDK already enforces a hard deadline via context cancellation, so you usually don't need to raise this manually.

return nil, worker.NewTimeoutError("upstream took too long", err)

See also