Temporal retry policies and non-retryable errors

Retry settings decide whether a Temporal workflow recovers from a flaky dependency or repeats a business failure until it floods logs and downstream systems. This page covers how to tune them, classify errors and verify the result.

On this page

Why Temporal retry policies decide whether workflows recover or fail loudly

Retry policies decide whether a Temporal workflow recovers from a fault or keeps hammering a system that has already rejected the request. Consider a team whose activities call a payment API, an HR system and a messaging service. Some failures are transient, such as a timeout or a brief outage, and should be retried. Others are business rejections, such as a declined payment, an unknown employee ID or a blocked recipient, and retrying them only repeats the same answer, sometimes with side effects. By default, Temporal retries a failed activity with exponential backoff and no maximum attempt count, so a business error can keep running until someone intervenes. Retry policies and non-retryable error types are the controls that separate these two cases.

A retry policy sets the initial interval, the backoff coefficient, the maximum interval, the maximum attempts and the list of error types that should not be retried. Business failures should be raised as application errors marked non-retryable, so the activity stops and the workflow can branch to compensation, a human task or a clear failure. Decide the classification with the owners of each downstream API: which HTTP status codes, error codes or exception types mean the request will never succeed, and which mean try again later. Confirm the exact error-type strings and failure-handling behavior in the Temporal documentation for the SDK your team uses, because the mechanics differ by language.

Teams usually need dedicated tuning work when activities hit rate-limited APIs, when a failed payment could be charged twice, or when a stuck retry loop has been hiding a business error for hours. A partner typically inventories every activity, classifies its errors with the service owners, sets policies per activity rather than one global default, and pairs each policy with a start-to-close or schedule-to-close timeout that bounds total retry time. They also add tests that inject each error class, and dashboards that show retry counts so that operators see failing activities early. Ask any implementation partner to show the error catalog and the test evidence for each non-retryable path before the workflows go live.

How a failed activity moves through retries, timeouts and final failure

The diagram starts with one activity attempt. When it succeeds, the result returns to the workflow. When it fails, the retry policy checks whether the error type is marked non-retryable and whether attempts remain. Retryable failures wait through the backoff and run again. Activity timeouts cap each attempt and the whole activity, so a hung attempt becomes a failure the policy can act on. Both non-retryable failures and exhausted retries reach the workflow, where its code decides the next step. Check the retry policy settings and error types against that decision.

A failed attempt passes the retry policy before the workflow sees the outcome.

Temporal retry policy settings and when each fits

This table lists the retry policy fields a team usually tunes for Temporal activities and workflows, what each one controls, and when changing it makes sense. Exact field names and default values differ by SDK, so confirm them in the documentation for your language before writing any policy.

SettingWhat it controlsWhen changing it makes sense
Initial intervalThe wait before the first retry after a failed attempt.Raise it when the downstream system needs time to recover from transient overload; keep it short for fast, cheap calls.
Backoff coefficientThe multiplier applied to the wait between successive retries.Increase it to back off harder from a struggling dependency; set it to 1 for a constant wait between attempts.
Maximum intervalThe cap on how long any single retry wait can grow.Set it when exponential growth would push waits beyond what a user, batch window or external timeout tolerates.
Maximum attemptsThe number of attempts before the failure is returned to the workflow.Lower it for calls whose retries add cost or duplicate side effects; use unlimited attempts only with a clear activity timeout bound.
Non-retryable error typesError types that stop retries immediately and fail the activity.Add business errors such as invalid input, rejected authorization or a missing record, where another attempt cannot change the result.
Schedule-to-close or start-to-close timeoutThe total time allowed across all attempts, or for a single attempt.Set it so retries cannot run indefinitely; confirm how each SDK applies it together with the retry policy.

Retryable or non-retryable: classifying business errors

Timeouts, connection resets, DNS hiccups and temporary unavailability of a downstream dependency are the faults Temporal retries are built for. The activity did not reach a decision about the business operation, so repeating it after a delay is normally correct, provided the activity is idempotent. Keep the default exponential backoff for these errors and leave them retryable, so the activity keeps going until the dependency returns or the workflow's timeouts end the attempt.

  • Leave them retryable: Do not raise a transient network error as an application error with a non-retryable flag. Let the SDK's default error handling retry it.
  • Bound the effort: Set a maximum attempt count or a schedule-to-close activity timeout so a dependency that stays down eventually fails the activity visibly.
  • Tune intervals to the dependency: Choose the initial interval, backoff coefficient and maximum interval based on how quickly the dependency usually recovers, and confirm those values with the service owner.
  • Protect idempotency: Retries repeat side effects. Pass a stable idempotency key to the downstream call so a request that succeeded before a timeout is not applied twice.

Confirm with the dependency owner which failures are safe to repeat before you write the retry policy.

Combining Temporal retry policies with activity timeouts

Timeouts, not the attempt count, set how long a Temporal activity can keep retrying. A retry policy with many attempts still ends in bounded time only if the activity's timeouts cap the total window. The start-to-close timeout limits each individual attempt, so a hung call is cut off and handed back to the retry policy. The schedule-to-close timeout limits the whole activity, from first scheduling through every retry, so it is the setting that guarantees an end point. Confirm in the Temporal SDK you use which timeouts are required and how each one is named in your code, because an activity without the right bound can retry for a window your team did not intend.

A long or open-ended retry window leaves a workflow waiting on a dependency that will not recover. The activity keeps failing, the workflow stays open, and the business process sits in an unresolved state that operators must find and clean up later. This is most common when a downstream service is down for a sustained period, or when an error is actually a business rejection that should have been marked non-retryable. Decide in advance what the workflow does when the schedule-to-close timeout expires: compensate, route to a person, or fail with a clear reason that alerting can pick up.

Review the timeouts every time the retry policy changes. Raising the maximum attempts or the maximum interval without re-checking the schedule-to-close timeout quietly extends how long work stays open, and lowering the backoff can overload a service that is already struggling. Ask the team to record the intended worst-case duration for each activity, test that the timeouts produce that duration in a non-production environment with a forced failure, and include the timeout values in code review alongside the retry settings so they change together.

Setup sequence for tuning retries and verifying them

This sequence moves retry behavior from Temporal's defaults to deliberate, per-activity policies that match each failure mode, and it closes with evidence from event histories that the policies behave as written. Each step ends with a check you can repeat after every change.

  1. Inventory activities and their dependencies

    List every activity in each workflow type, and for each one record the external system it calls, the owner of that system, and whether the call writes data or only reads it. Include calls made through SDKs, internal services and third-party APIs. Owners of the workflow code and the downstream systems should review the list together, since the downstream owner usually knows rate limits and maintenance windows that the workflow team does not. The step is done when every activity has a named dependency and an owner, and the list is stored with the workflow code.

  2. Classify each failure mode

    For each dependency, sort the errors it can return into transient failures (timeouts, connection resets, throttling, temporary unavailability), business rejections (invalid account, insufficient funds, a record that already exists) and programming defects (bad payloads, missing fields, unexpected states). Confirm the classification against the downstream API documentation and recent incident data where available. The output is a table that maps each error type to one of the three classes, and a reviewer should be able to point to the classification that applies to any error seen in production.

  3. Set retry policies per activity

    Assign a retry policy to each activity rather than relying on one shared default. Retry policies in Temporal use exponential backoff by default, and the policy controls the initial interval, backoff coefficient, maximum interval and maximum attempts. Activities that call rate-limited APIs typically need longer intervals, while low-latency internal calls may need shorter ones. Confirm the default values in the Temporal documentation for your SDK version before you change them. The check is that each activity options block states its policy explicitly in code review.

  4. Define non-retryable error types

    Mark the business rejections and programming defects from the classification step as non-retryable error types in the retry policy, so Temporal stops retrying them and surfaces the failure to the workflow. Use stable, named error types so that workflow code can match them and so that operators can search for them in the Web UI. Keep the list short and reviewed, because marking a transient error as non-retryable converts a temporary outage into a failed execution. The check is that each non-retryable type has a documented reason and a test that raises it.

  5. Align timeouts with the retry policy

    Set the activity start-to-close timeout (or schedule-to-close timeout where it fits) so that the total time for all attempts, including backoff intervals, fits inside the workflow's expected duration and inside any upstream deadline. Check that a single slow attempt cannot consume the whole budget before a retry happens, and that the maximum attempts setting is reachable within that budget. Ask the team that owns each dependency what response time they guarantee, and use that figure to set the per-attempt timeout. The check is a short calculation per activity, recorded beside its policy, showing the worst-case path.

  6. Inject transient failures in a test environment

    Run each activity against a stub or fault-injection layer that returns transient errors for a set number of calls, then succeeds. Confirm in the Temporal Web UI or the workflow's event history that the number of attempts matches the policy, that the intervals grow as the backoff coefficient predicts, and that the workflow completes once the stub recovers. Repeat with a failure that never recovers and confirm that the attempts stop at the maximum attempts setting and that the activity failure reaches the workflow. Keep the event histories as evidence for the review.

  7. Inject business and programming failures

    Trigger each non-retryable error type in the test environment and confirm in the event history that Temporal records one attempt and then fails the activity, with no further retries. Verify that the workflow code handles the failure through its intended path, such as a compensation step or a notification, and that a programming defect still produces a visible failure rather than a silent loop. Also confirm that the error type name appears in the failure details so that operators can filter on it. The step is done when every non-retryable type has a passing test with a matching event history.

  8. Review policies after each change

    Rerun the injected-failure tests whenever a retry policy, timeout or non-retryable type changes, and compare the event histories with the previous baseline. Keep a short record of each policy change, the reason for it and the owner who approved it, so that the next incident review can trace behavior back to a decision. Confirm with the downstream owners whenever their error responses change. The output is a versioned retry configuration and a set of event-history baselines that the team can use as a regression reference.

Retry mistakes that hide failures or amplify load

Retry settings look harmless in code review but shape how failures surface and how much load reaches downstream systems. The mistakes below share one root cause: a retry policy that was never matched to the error, the external system and the business deadline it serves.

Retrying business rejections

A declined payment, an invalid account number or a failed credit check will fail the same way on every attempt. When these errors stay retryable, the activity runs its full attempt budget, the workflow looks busy instead of failed, and the business decision is delayed. Check each activity's error types and mark rejections that must not be retried as non-retryable, so the workflow can route them to a compensation or review step on the first failure.

Temporal deployment docs

Unlimited attempts on rate-limited APIs

An activity that calls a rate-limited API with no maximum attempts keeps retrying on the backoff schedule while the provider keeps throttling it. Many workers then retry in step, which amplifies load on the very service that asked for relief. Set a finite maximum attempt count, a maximum interval that fits the provider's limits, and a backoff coefficient, and confirm the limits in the provider's own documentation.

Timeouts that outlast the business deadline

An activity with a long schedule-to-close timeout can keep retrying after the customer, the batch window or the regulatory cutoff has passed. The workflow then completes work nobody needs or reports a stale outcome. Derive the workflow run timeout and the activity timeouts from the business deadline, and make sure the workflow takes the timeout path explicitly rather than waiting for retries to finish.

Retrying side effects without idempotency keys

When an activity charges a card, sends a notice or creates a ticket, a retry after a lost response can repeat the side effect. The first call may have succeeded even though the worker never saw the result. Pass a stable idempotency key derived from the workflow ID and the step, and confirm that the downstream API honors it before enabling retries on that activity.

One policy for every activity

A single default retry policy applied to lookups, payments, file uploads and notifications treats every failure the same way. Read-only calls can usually retry quickly, while writes to external systems need slower, bounded retries and different error handling. List each activity with its idempotency, its downstream limits and its deadline, then give each one a policy written for that profile.

Failure paths left untested

Retry behavior is rarely exercised by happy-path tests, so a wrong error type or a missing non-retryable marker surfaces first in production. Write tests that inject each error class, simulate a throttled dependency and a timeout, and assert the attempt count and the final workflow state. Repeat these tests whenever a retry setting or error type changes.

Questions buyers ask about tuning Temporal retries

How much work is involved in tuning Temporal retries?

The work scales with how many activities the workflows contain, how many external dependencies they call, and how well the team has classified its errors. A workflow with a few activities calling one payment API is a small review. A platform with dozens of workflow types, each calling several internal services and third-party APIs, needs an inventory of every activity, its timeouts, its current retry settings and the errors each dependency returns. The error taxonomy is often the largest driver. If the team cannot say which failures are transient and which are business rejections, the review has to start with that classification. Ask a provider to break its quote down by activity count, dependency count and whether a taxonomy already exists.

Can our own team tune Temporal retries without a partner?

Yes, if the team has engineers who know the workflow code and the systems each activity calls. Retry policies are set in code or in the activity options, so the change itself is small. The harder part is knowing what each downstream system returns during an outage, which error types are safe to retry, and whether an activity is idempotent. Teams that already run Temporal in production often do this in-house. Teams new to Temporal, or with many activities crossing several owners, often bring in outside help for the review and then keep the rules in their own repository. Either way, the decision should rest on who can test failure behavior against real dependencies.

What does tuning retries need from engineering and business owners?

Engineering owners need to supply the workflow and activity code, the dependency documentation, and access to a non-production environment where failures can be injected. They also decide which activities are idempotent and what happens when a retry duplicates a side effect. Business owners are needed to decide which outcomes are final: a declined payment, a rejected account number, or a validation failure that should stop the workflow rather than retry. They also set how long a process may remain in progress before someone is alerted. Agree these owners and their sign-off points before the review starts, because open questions about business rules are the most common cause of delay.

How long does a retry policy review usually take?

The duration depends on scope: the number of workflow types, the number of activities in each, how many dependencies have unclear error behavior, and how quickly owners can answer questions. No standard figure applies across platforms. A useful way to plan is to split the work into an inventory phase, a classification phase per dependency, and a verification phase where failures are tested. Ask any provider for a timeline tied to a written scope with named deliverables, and ask which of those phases depend on owners responding. A timeline that does not state its assumptions about owner availability is hard to hold a provider to.

Can retries be changed on workflows that are already running?

Activity retry settings are recorded in the workflow's event history when an activity is scheduled, so changing the policy in code does not rewrite attempts that have already started. Teams should confirm this behavior against the Temporal version they run before relying on it. In practice, a change applies to new activity executions, and in-flight workflows may keep their existing settings until they complete or are reset. Changing the code path a running workflow takes also raises versioning questions. Plan the rollout so that workers handling old and new code can coexist, and test a retry change against a running workflow in a staging namespace before production.

What should a quote for retry tuning include?

A quote should list the written scope in concrete terms: the workflow types and activities in scope, the dependencies whose error behavior will be classified, and the environments where failure tests will run. It should name each deliverable, such as a retry policy register, a non-retryable error list, test evidence for each dependency, and handover notes for the engineering team. It should state which owner decisions the work depends on and what happens if they are delayed. Ask whether ongoing review is included when new activities are added, and whether any retesting after a dependency upgrade is priced separately. Ask for the assumptions behind the estimate, not only the total.

Which retry settings create the most risk if left unreviewed?

The main risks come from retrying activities that are not idempotent, retrying business rejections that will never succeed, and setting unlimited attempts with no timeout. Each of these can duplicate payments, flood a downstream service, or leave a workflow stuck without an alert. Teams should confirm the maximum attempts and interval settings for each activity, check that the activity timeout bounds the total time spent retrying, and confirm that non-retryable error types are raised for validation and authorization failures. Review these settings with the people who own the downstream systems, since they know which failures their services return under load.

Security and operations when retries call external systems

Every retry an activity makes is another call to the external system, so retry settings are an operational and security decision as much as a reliability one. A payment or account API that rate-limits, locks an account after repeated failed authentications, or accepts a charge without a stable request identifier can be harmed by a retry policy that looks correct in code. The first control is idempotency: pass a stable key derived from the workflow ID and the business operation (not from the attempt number) to every side-effecting call, so that a retried attempt after a lost response does not create a second charge or record. Confirm with each provider how its idempotency keys expire and whether they cover every endpoint your activity calls.

Make attempt behavior observable before production traffic depends on it. Use the Temporal visibility store and your metrics stack to alert on activities whose attempt count climbs above what the business expects, and on failure types, separating retryable transport errors from non-retryable business errors such as declined payments or validation failures. A spike in a single failure type is often the first sign of a credential rotation, a provider outage or a bug in the calling code. Decide who is paged, and what the on-call runbook says to do with a workflow that is still retrying, before the first incident. Thresholds should come from your own traffic and provider limits, not from defaults.

Failure messages and error details are persisted with the workflow history, so review what your errors contain. An application error that includes a full request body, an account number or a token will be stored and may appear in the Web UI, logs and exports. Keep error messages to stable codes and non-sensitive context, and check that the activity does not echo the provider's response verbatim. Payload handling is configured separately from retries: encryption of payloads with a custom codec and a codec server, access to the Web UI, and who can read history all need their own design. Confirm the current behavior and settings in the Temporal self-hosted security documentation before you assume that sensitive fields are protected.

Limits and what to confirm in your environment

Retry behavior in Temporal depends on the SDK version your workers run, the server version behind them, and how your downstream systems report failure. The cards below list the items to confirm with your platform team, your application owners and your vendors before you finalize a retry design. Each item links back to a decision that is easy to get wrong when it is assumed rather than checked.

Default retry behavior in your SDK

Confirm what the default retry policy does in the SDK version your workers run, including the initial interval, backoff coefficient, maximum interval and whether maximum attempts is unlimited. Retry defaults are set by the SDK, so a worker upgrade can change behavior without any change to your workflow code. Ask the SDK owner to show the effective values in a running activity, not only in the documentation.

Temporal deployment docs

Error handling support by version

Confirm that your SDK and self-hosted server versions support the error handling you plan to use, including marking specific failure types as non-retryable. Check this against the release notes for each component, because the server and SDK ship on different schedules. Record the exact versions in your design so that a future upgrade is tested against the same behavior.

How downstream APIs signal throttling

Ask each downstream owner which responses mean retry later, such as rate limit or service unavailable, and which mean stop, such as a validation rejection, a declined payment or a closed account. Some APIs return the same status code for both cases, so the mapping needs to be written down per endpoint. Without this mapping, activities either retry permanent rejections until attempts run out or give up on transient outages too early.

Which activities are safe to retry

Confirm with each activity owner whether repeating the call can cause a second charge, a duplicate record or a second message. Retries are only safe when the external call is idempotent or when it can be checked against an idempotency key before it runs again. Activities that are not safe to retry need a shorter maximum attempts setting, or a compensating step, and this should be a named decision in your design.

Retries, shutdown and task queue capacity

Confirm how long your workers take to drain in-flight activities during a deployment, and how many retry attempts can pile up on a task queue while a dependency is down. Long backoff intervals keep activities waiting in the schedule and can consume worker slots when a downstream outage lasts. Ask your platform team to test a rolling restart during a simulated outage before you set the final intervals.

Where error taxonomy decisions live

Confirm who owns the list of error types that workflows and activities raise, and where that list and each retry decision are recorded. Without a single record, each team names failures differently, and the same error is marked retryable in one service and non-retryable in another. Ask the platform lead to set a review step for changes to the list, tied to your normal change process.

How DeployOpen scopes and delivers retry tuning for Temporal

DeployOpen reviews the activities in your Temporal workflows, separates transient failures from business errors, and writes retry settings for each class of activity. The work is scoped in writing before it starts, then built, tested and handed over in your own infrastructure with the reasoning documented for your engineers.

How we scope

  • Inventory every activity, its external dependency and the failures it can return today.
  • Agree in writing which activities get custom retry policies and which keep defaults.
  • Define the non-retryable error types, owners and the business decisions behind each one.

How we build

  • Set initial interval, backoff coefficient, maximum interval and maximum attempts per activity type.
  • Pair each retry policy with start-to-close and schedule-to-close timeouts so attempts stay bounded.
  • Test retry behavior with forced failures in a non-production namespace before any release.

How we hand over

  • Document each retry policy, its rationale and the error types that bypass retries.
  • Walk your workflow and platform engineers through the settings and how to change them safely.
  • Deliver runbook steps for reading retry history in the Temporal Web UI during an incident.

How we support

  • Review retry settings again when activities change, new dependencies are added or SDK versions move.
  • Offer ongoing support and upgrades as a retainer if your team wants continued tuning help.
  • Confirm with your vendor and environment which retry and timeout behaviors apply to your SDK version.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.