n8n: Retry a 429 or a 500, Fail Fast on a 401. HTTP Status Codes, Retry On Fail and the Error Output
Description and use
In n8n, configure retries only for 429 and 5xx, fail fast on 4xx, and alert via Gmail to avoid silent failures and unnecessary retries.
Problem
An n8n workflow often fails because a supplier’s server is busy (429/500) or an API key has expired (401/403), causing silent retries or missed alerts.
Outcome
The workflow now retries only for transient server errors, fails fast on authentication or client errors, and alerts the owner via email, preventing silent failures and unnecessary retries.
Workflow
- Configure HTTP Request node to include response headers and never error
- Set Retry On Fail to true, Max Tries 3, Wait Between Tries 5000ms
- Add a Code node to inspect statusCode and decide action
- If statusCode 200‑299: continue
- If 429 or >=500: retry up to 3 times, respecting Retry‑After header
- If 400,401,403,404: fail and send Gmail alert
- Wire Error output to Gmail Send a message node
Evidence
The most common way an n8n workflow fails in a small business isn't a bug. It's a supplier's server being busy at 6 AM.
Retry On Fail doesn't look at the code. A 401 gets retried three times, five seconds apart, exactly like a 503.
In the HTTP Request node, under Options, Response, turn on Include Response Headers and Status and Never Error.
- Record date: 2026-10-23T16:26:10.211Z