Skip to content
Visual explainer 3h to learn 5 steps

n8n error workflows, bounded retries and safe replay

Classify workflow errors, apply bounded retries, route failures to review and replay a failed event without side effects.

By Invicly Tech, , in n8n, AI Automation and Voice Agents. About 9 minutes to read.

Topic 31 of 43

In short

Workflows fail in two ways. Transient errors, such as a timeout or a rate limit, may work on a second try. Permanent errors, such as bad input or a missing permission, never will. You retry the first kind a few times, route the second to a person, and replay failures only in a way that cannot repeat a side effect.

Think of it like this: It is like a parcel that did not arrive: try the doorbell again if nobody answered, but if the address is wrong, call the sender rather than trying forever.

Explained simply

Things go wrong in automation all the time. A service is slow, a login expires, a form sends a bad date. The skill is not avoiding every failure. It is deciding what to do when one happens.

Start by sorting errors into two groups. A transient error is temporary: a timeout, a busy server, a rate limit. Trying again later often works. A permanent error will fail every time until someone fixes it: wrong data, missing permission, a deleted record.

In n8n you can switch on Retry On Fail for a node, choose how many tries and how long to wait between them. Keep the numbers small. For anything that cannot be fixed by waiting, let the workflow fail and hand it to a person.

That hand-off is an error workflow. It is a separate workflow that starts with an Error Trigger node. When another workflow fails, it runs and can send a message or add a row to a review list with the details. Replaying is the last step, and it must be safe: using an event ID means a second run will not repeat a booking.

Press Play on a diagram to walk through it one step at a time.

FlowWhat happens when a node fails
  1. 1
    Node fails

    Error message and status code

  2. 2
    Classify

    Transient or permanent?

  3. 3
    Retry on fail

    A few tries with a wait

  4. 4
    Error workflow

    Error Trigger starts a second workflow

  5. 5
    Review queue

    A person decides

  6. 6
    Safe replay

    Same event ID, no duplicate

MapA rule table for appointment workflow errors
Error seen
  • Retry a few times
    • Timeout
    • 429 rate limit
    • 502 / 503 / 504
  • Send to review
    • 400 bad slot value
    • 403 no calendar access
    • Unknown customer
  • Skip as done
    • 409 booking already exists
  • Stop and page
    • Credential expired
    • Database unreachable

In depth

Classify before you retry

Look at the status code and message. Timeouts, 429 (too many requests) and 5xx server errors are usually transient. 400, 401, 403 and 404 usually mean the request or the permissions are wrong, so a retry just repeats the failure. Some cases sit between: a 409 conflict may mean someone else already did the work. Write down your own rule table once, and apply it the same way across workflows.

  • Transient: timeout, 429, 502, 503, 504
  • Permanent: 400, 401, 403, 404, validation errors
  • Needs thought: 409 conflict, partial success
  • Honour a Retry-After header when the API gives one

Retries on a node

In a node's settings you can enable Retry On Fail, then set the maximum number of tries and the wait between them. Check the current n8n docs for the allowed ranges, since the editor limits them. A short wait with few tries suits quick glitches. For a rate limit, wait longer. If the node has a side effect, such as sending an email, a retry can repeat it, so send an idempotency key or check first whether the action already happened. Node settings also include what to do on error: stop the workflow, continue, or continue through a separate error output you can route.

CompareOn Error choices for a node
Stop workflow
  • Default behaviour
  • Triggers the error workflow
  • Good for must-not-miss steps
Continue
  • Moves on with the input item
  • Risk: hides the failure
  • Use only if the step is optional
Continue with error output
  • Sends failures down a second path
  • You decide what to do
  • Good for per-item handling

Error workflows and review routes

Create a workflow that begins with an Error Trigger. Then, in each workflow you want covered, open its settings and pick that error workflow. The trigger receives the execution ID, a link to it, the error message, the last node that ran and the workflow name. Use these to write a clear review item. Do not copy secrets or full personal data into messages. If the failure happened in a trigger node itself, the data has a different shape, and the execution link may be missing.

  • One error workflow can serve many workflows
  • Test it by forcing a failure with a Stop and Error node
  • Review item: what failed, where, link, owner
  • Alert a person, not just a log

Replay without side effects

n8n lets you retry a failed execution from the executions list. That is useful, but it re-runs steps, so each step with a side effect must tolerate it. Give each business event a stable ID, such as the request ID. Before writing, look it up: if the booking for that ID exists, skip. Write the result and the ID together. Then replaying twice gives the same outcome as replaying once. Record each replay: who ran it, when, and what changed.

Learn it in 5 short steps

About 35m each. Track them with a timer in your plan.

  1. 1
    Classify transient and permanent errors~35m
  2. 2
    Set retries on nodes~35m
  3. 3
    Attach an error workflow~35m
  4. 4
    Route failures to review~35m
  5. 5
    Replay a failed execution safely~35m

Key points

  • Retry only transient errors, with a small maximum number of tries and a wait between them.
  • An error workflow starts with the Error Trigger node and is chosen in each workflow's settings. One error workflow can serve many workflows.
  • The Error Trigger passes the execution ID, a link, the error message and the last node that ran.
  • Send failures to a review route with enough context to act on, and no secrets.
  • Replay must be idempotent: use an event ID so a second run does not create a second booking.

Key terms

Tap a card to flip it. 0/5 known

Examples

Idempotent booking write

Scenario: a replay must not double-book. Steps: before creating, look up the event ID; create only if missing. Evidence: running the same event twice leaves exactly one booking row. Cleanup: delete test rows. Use a fake calendar table such as example_bookings.

sql
INSERT INTO bookings (event_id, customer, slot_start)
VALUES ($1, $2, $3)
ON CONFLICT (event_id) DO NOTHING
RETURNING id;
-- no row returned means it already existed: treat as success

Build and test an error workflow

Prerequisites: a local n8n and a throwaway workflow. Steps: create a workflow named Failures with an Error Trigger followed by a node that adds a row to a review sheet. In a second workflow, add a Stop and Error node, then set Failures as its error workflow. Run it. Evidence: a new review row appears with the execution ID and message. Cleanup: remove the test workflows.

json
{
  "event": "workflow_failed",
  "workflow": "Booking intake",
  "execution_id": "<id>",
  "last_node": "Create booking",
  "message": "403 Forbidden",
  "class": "permanent"
}

Quick reference

  • Transient (timeout, 429, 5xx): retry a few times with a wait.
  • Permanent (400, 401, 403, 404): do not retry; send to review.
  • Error workflow = starts with an Error Trigger; set in workflow settings.
  • Force a test failure with the Stop and Error node.
  • Every side effect needs an event ID and a check before writing.
  • Keep secrets and full personal data out of alerts.

Common mistakes

  • Retrying a node that sends an email or writes a booking without an idempotency key, so a retry makes a duplicate.
  • Setting many retries with no wait, which hammers an API that is already struggling.
  • Building an error workflow that itself can fail silently. Test it by forcing an error.

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1Which error is most likely transient?

Question 2

2How do you attach an error workflow?

Question 3

3What makes replay safe?

Question 4

4A node set to Continue hides a failure. When is that acceptable?

0/4 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    Sort these into transient or permanent: timeout, 403, 429, 400.

  2. Exercise 2medium

    Design the review item an error workflow should create. List the fields and what to leave out.

  3. Exercise 3hard

    Write the replay procedure for a failed booking event, including how you prove it did not double-book.

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

How many retries should I set?
A small number, such as two or three, with a wait. More retries on a failing service usually make things worse.
Does the error workflow run for manual test runs?
Generally error workflows are for production executions, so test with a real trigger or check the current docs for your version.
Can I retry a failed execution from the UI?
Yes, from the executions list. Make sure side effects are idempotent first.

Go deeper

ShareXLinkedInWhatsApp