n8n Retry On Fail: retry only 5xx and 429, not every error
By the TestedFlows team · Published November 15, 2026
Tested on n8n 2.43.5 · 15 November 2026
This page contains affiliate links. If you sign up through them we may earn a commission, at no extra cost to you. How we make money.
Retry On Fail is the first thing most people switch on when an API call in n8n fails now and then. It works, but it does less than its settings suggest, and it does some things you probably don’t want. On 15 November 2026 we tested it on n8n 2.43.5 against a test API that we could make fail on purpose: fail twice and then work, always return 404 or 401, stay down with 503, or return 429 with a Retry-After header. Every result below comes from those runs.
What Retry On Fail actually does
You find it on any node under Settings: switch on Retry On Fail, then set Max. Tries and Wait Between Tries (ms). This is what happened in our tests with an HTTP Request node:
| Test API behaviour | Settings | Requests sent | Result |
|---|---|---|---|
| 500, 500, then 200 | 3 tries, 1,000 ms | 3, one second apart | Succeeded |
| Always 404 | 3 tries, 1,000 ms | 3, one second apart | Failed after 2 seconds |
| Always 401 | 3 tries, 1,000 ms | 3, one second apart | Failed after 2 seconds |
| Always 503 | 10 tries, 10,000 ms | 5, 5 seconds apart | Failed after 20 seconds |
429 with Retry-After: 3, twice, then 200 |
3 tries, 200 ms | 3, 0.2 seconds apart | Succeeded, but ignored the 3-second wait |
| 500, 500, then 200 | Retry On Fail off | 1 | Failed immediately |
Three things stand out.
It retries errors that can’t succeed. A 404 means the URL is wrong, and a 401 means the credentials are wrong. Retrying them only adds delay before the workflow fails and sends extra requests the API may count against you.
It is capped, silently. We set 10 tries and 10,000 ms, and n8n made 5 tries, 5 seconds apart. n8n’s code limits Max. Tries to between 2 and 5, and Wait Between Tries to between 0 and 5,000 ms, so higher values in the settings are ignored. The longest the built-in retry can wait in total is 20 seconds.
It ignores Retry-After. When an API returns 429 Too Many Requests, it usually says how long to wait in a Retry-After header. n8n retried after 0.2 seconds, as set, even though the API asked for 3. Against a strict API, those early retries can extend the rate limit.
These are the errors n8n showed for each failure, so you can recognise them in your executions:
404: The resource you are requesting could not be found
401: Authorization failed - please check your credentials
503: Service unavailable - try again later or consider setting this node to retry automatically (in the node settings)
500: The service was not able to process your request
When the built-in retry is enough
Keep Retry On Fail if the API fails only now and then for a second or two and recovers quickly, and your requests are safe to repeat. Use 3 tries and 1,000 to 2,000 ms. Raise the wait above the 200 ms many examples use, because three tries within half a second usually hit the same failing server.
If the API rate-limits you, has longer outages, or you want 401 and 404 errors to fail at once, use the workflow below instead.
A workflow that retries only 5xx and 429

The idea is to stop the HTTP Request node from failing, look at the status code yourself, and loop back through a Wait node only when retrying makes sense. You can download this workflow and import it in n8n (Workflows, then Import from File), or build it in five steps.
1. HTTP Request node. Turn Retry On Fail off. Under Options, add Response and switch on Include Response Headers and Status and Never Error. The node now passes on every response, with statusCode, headers and body, even a 500.
2. Code node “Check response” decides what to do with each response:
const r = $input.first().json;
const attempt = $runIndex + 1;
const status = r.statusCode;
const retryAfter = Number((r.headers || {})['retry-after']);
const retryable = status === 429 || status >= 500;
return [{ json: {
status,
attempt,
ok: status >= 200 && status < 300,
retry: retryable && attempt < 5,
waitSeconds: retryAfter > 0 ? retryAfter : Math.min(2 ** attempt, 60),
body: r.body,
} }];
$runIndex counts how many times this node has run in the current execution, so it doubles as the attempt counter. The wait uses Retry-After when the API sends one in seconds, and otherwise doubles each time: 2, 4, 8, then 16 seconds. To allow more attempts, change attempt < 5.
3. If node “Success?” with the condition {{ $json.ok }} is true. The true output goes on to the rest of your workflow; in ours it is a Result node that returns $json.body.
4. If node “Retry?” on the false output, with the condition {{ $json.retry }} is true. True goes to a Wait node set to After Time Interval, with the amount {{ $json.waitSeconds }} and the unit Seconds. Connect the Wait node’s output back to the HTTP Request node’s input.
5. Stop and Error node on the false output of Retry?, with the message {{ "Request failed with HTTP " + $json.status + " after " + $json.attempt + " attempt(s)" }}. The execution fails with a clear reason, so your error workflow or failure notifications still trigger.
We ran this workflow against the same test API:
| Test API behaviour | Requests sent | Waits between them | Result |
|---|---|---|---|
| 500, 500, then 200 | 3 | 2 s, 4 s | Succeeded |
| Always 404 | 1 | none | Failed at once: Request failed with HTTP 404 after 1 attempt(s) |
429 with Retry-After: 3, twice, then 200 |
3 | 3 s, 3 s (as the API asked) | Succeeded |
| Always 503 | 5 | 2 s, 4 s, 8 s, 16 s | Failed: Request failed with HTTP 503 after 5 attempt(s) |
Compared with Retry On Fail, the 404 now fails in 0.1 seconds instead of 2, the 429 waits exactly as long as the API asks, and the outage gets 30 seconds of backoff instead of being cut off at 20.
Before you retry anything
- Only retry requests that are safe to repeat. GET requests are. A POST that creates an order, sends an email or charges a card may already have worked even though the response was a 500, and retrying it can create duplicates. For those, check whether the API supports an idempotency key, or check for the record before trying again.
- 429 means slow down, not try harder. If you hit rate limits often, send fewer requests: use the HTTP Request node’s Batching option, or add a Wait between items.
- Some 4xx errors are worth one retry. 408 (Request Timeout) can succeed on a second attempt. Add
|| status === 408toretryableif your API returns it. - Retry-After can also be a date. Our code handles the seconds form, which most APIs use. If yours sends an HTTP date, the code falls back to the doubling wait.
If a workflow keeps failing and you can’t find the cause, see our Code node errors guide, the troubleshooting hub, or have us fix it with our n8n workflow fix service.
Try n8n Cloud freeFrequently asked questions
Does n8n Retry On Fail retry 4xx errors?
Yes. In our test it retried a 404 and a 401 three times each, the same as a 500. To skip 4xx errors, use a status-code check like the workflow above.
What is the maximum number of retries in n8n?
With the built-in setting, 5 tries in total, with up to 5 seconds between them. Higher values in Max. Tries or Wait Between Tries are capped without any warning. A Wait node loop has no such limit.
Does n8n respect the Retry-After header?
Not with Retry On Fail. In our test it retried a 429 after 0.2 seconds even though the API asked for 3. Read the header with Include Response Headers and Status and pass it to a Wait node, as shown above.
Where is Retry On Fail in n8n?
Open the node, click the Settings tab, and switch on Retry On Fail. Max. Tries and Wait Between Tries (ms) appear below it. It is available on most nodes, not only HTTP Request.
How we tested: on 15 November 2026 we ran n8n 2.43.5 with a local test API that returned 500, 404, 401, 503 or 429 (with Retry-After: 3) on demand and logged the time of every request. We triggered each workflow through a production webhook and measured the number of requests and the gaps between them. The 5-try and 5-second limits are also in n8n’s execution code (getRetryParams in workflow-execute).
Sources: n8n HTTP Request node, n8n Wait node, n8n: handle rate limits, MDN: Retry-After, MDN: 429 Too Many Requests.
Get the free workflow template pack
Tested n8n workflows you can import in one click, plus a short email when new templates and comparisons go live.