GTM Engineering term, automation and APIs

Retry logic

Retry logic is the set of rules an automation follows to re-attempt a failed operation, covering which errors to retry, how long to wait and when to give up.

Also called: retries, exponential backoff, retry policy, backoff and retry

Retry logic sits under every stage: it's part of the data and systems the whole funnel runs on, near related terms like Error handling, Idempotency and API rate limit (the blue squares).

Retry logic is the set of rules an automation uses to re-attempt a failed step: which errors deserve another try, how long to wait between attempts and when to stop and escalate. APIs time out, rate limits trip and vendors have bad minutes. Good retry logic absorbs those blips quietly, while bad retry logic either drops data or hammers a struggling API until it's worse.

How it works

A solid retry policy answers four questions:

  1. Is this error retryable? Temporary failures are: timeouts, connection resets, 429 Too Many Requests and 5xx server errors. Permanent ones aren't: 400 bad request, 401 or 403 permissions, 404 not found. Retrying those just repeats the failure.
  2. How long to wait? Use exponential backoff: wait 1 second, then 2, 4, 8, 16. Add jitter, a small random amount, so a hundred stalled runs don't retry in the same instant. If the response includes a Retry-After header, honor it.
  3. How many attempts? Cap it, commonly 3 to 5.
  4. What happens after the last failure? Send the item to a dead letter queue or failure table and alert a human through your error handling.

Retries only work safely if the step has idempotency. Otherwise a request that actually succeeded but timed out on the response gets repeated and creates a duplicate.

Example

Say an enrichment workflow makes 20,000 API calls a month and 1% fail with temporary errors (assumption). With no retries, that's 200 records a month left unenriched, often without anyone noticing.

Add retries with backoff at 1, 2, 4 and 8 seconds. If failures were fully independent, the chance a record fails all 5 attempts is 0.01^5, effectively zero. Real failures cluster during outages, so assume half of the 200 recover on the first retry and most of the rest within the backoff window, leaving maybe 5 to 10 for the failure queue. The total extra wait per failing record is at most 1 + 2 + 4 + 8 = 15 seconds, invisible for a batch job.

Where retries live

Most iPaaS tools offer built-in retries on some steps, plus settings for auto-replay of failed runs. Webhook senders usually retry deliveries to you on their own schedule. In code, SDK clients and HTTP libraries often include retry options, and queues like SQS redeliver failed messages automatically.

For a data pipeline or a big backfill, retry at the record level, not the whole job, so one bad record doesn't restart 50,000 good ones. And track retry counts in your observability setup. A rising retry rate is often the first sign of an API change or a looming API rate limit problem.

Common mistakes

  • Retrying instantly in a tight loop, which extends rate limit lockouts.
  • Retrying 400 and 401 errors that can never succeed.
  • Unlimited retries, so a broken run burns tasks and credits all weekend.
  • Retrying non-idempotent create steps and producing duplicates.
  • Retrying silently with no record of how often it happens.

FAQ

What is exponential backoff?

Exponential backoff means waiting longer after each failed attempt, usually doubling the delay: 1 second, then 2, 4, 8 and so on. Adding random jitter to each delay keeps many clients from retrying at the same instant.

Which errors should you retry?

Retry temporary failures: timeouts, network errors, HTTP 429 rate limit responses and 5xx server errors. Don't retry errors that will fail the same way every time, like 400 validation errors, 401 or 403 permission errors and 404 not found.

How many times should an automation retry?

Three to five attempts with backoff is a common rule of thumb. After that, send the item to a failure queue and alert someone, because more retries rarely fix the problem and can make rate limits worse.

See all automation and APIs terms ↳

Used in these articles