Skip to main content

Error Handling & Retry Patterns

View Markdown

These patterns control how Temporal retries Activities, surfaces persistent failures, and recovers from errors that require human intervention.

Patterns in this section​

Choosing a pattern​

The following decision tree helps you select the appropriate retry strategy for your use case.

The following describes each decision point:

  1. If each attempt consumes a paid API call, a rate-limited token, or another scarce resource, use Fixed Count of Retries to cap total consumption.
  2. If the error is structural — a missing record, invalid input, or authorization failure — and cannot be corrected automatically, ask whether a human can fix it: if so, use Resumable Activity to park the Workflow and await a correction signal; otherwise use Non-Retryable Errors to fail fast.
  3. If the downstream system has a scheduled maintenance window and you know approximately how long it will be unavailable, use Delayed Retry with a fixed interval.
  4. If the process must resolve (one way or another) within a business SLA window such as 24 hours, use Fixed Wall-Time Retries with ScheduleToCloseTimeout.
  5. If you want to recover from transient errors quickly but also wait indefinitely for the downstream system to come back, use Fast/Slow Retries.
  6. For any long-running retry scenario, add Retry Alerting via Metrics to surface persistent failures before they breach an SLA.

How Temporal retries work​

Temporal's default RetryPolicy retries Activities indefinitely with exponential backoff. Unless you configure a policy, a failing Activity will keep retrying until the ScheduleToCloseTimeout or the Workflow itself completes.

The key RetryPolicy fields are:

FieldDefaultEffect
MaximumAttempts0 (unlimited)Caps total attempts including the first
InitialInterval1 secondDelay before the first retry
BackoffCoefficient2.0Multiplier applied after each retry
MaximumInterval100× InitialIntervalUpper bound on the backoff delay
NonRetryableErrorTypes[]Error types that skip retries entirely

ScheduleToCloseTimeout is set on the Activity call options, not in RetryPolicy. It caps the total wall-clock time from when the Activity is first scheduled to when it must complete — across all retry attempts.

References​