Every n8n workflow fails sooner or later. An API times out, a token expires, someone sends a form with no email. The real problem isn’t the failure; it’s not knowing about it until a client asks why nothing happened for three days. In this guide you’ll set up error handling in n8n so failures retry on their own when they can, get logged when they can’t, and always reach you with enough detail to fix them fast.
What you’ll build
- One error workflow that alerts you on Telegram, Slack or email whenever any of your workflows fails
- Automatic retries for flaky APIs
- Error outputs that send bad items to a “failed” list while the rest keep going
- Custom errors with the Stop And Error node, for data that’s technically valid but wrong
- An AI error explainer that tells you the likely cause and fix in plain English
The three layers of error handling
- Node level: retry the step, or keep going and route the failure somewhere useful.
- Workflow level: deliberately stop with a clear message when the data is wrong.
- Instance level: an error workflow that catches anything that still fails and tells you about it.
Start with layer 3. It takes five minutes and covers everything.
Step 1: Create an error workflow
Error Trigger
↓
Telegram / Slack / Gmail: "⚠️ Workflow failed"
- Create a new workflow called
Error Handler. - Add the Error Trigger node as the first node. An error workflow must start with it.
- Add a Telegram, Slack or Gmail node with a message like:
⚠️ {{ $json.workflow.name }} failed Node: {{ $json.execution.lastNodeExecuted }} Error: {{ $json.execution.error.message }} Open: {{ $json.execution.url }} - Save and publish the Error Handler workflow. n8n requires workflows that use the Error Trigger to be published.
- Open each workflow you want to watch, go to Options → Settings, choose
Error Handlerunder Error workflow, and save.
One error workflow can watch as many workflows as you like. New to messaging nodes? See our Telegram bot tutorial or the Slack notifications guide.
Important: the error workflow doesn’t run when you click Execute workflow to test manually. It only fires for real (production) runs. To test it, publish a workflow that fails on purpose, like a Schedule Trigger followed by a Stop And Error node, and let it run once.
What the Error Trigger gives you
workflow.idandworkflow.name: which workflow failedexecution.lastNodeExecuted: the node where it brokeexecution.error.messageandexecution.error.stack: what went wrongexecution.urlandexecution.id: a link to the failed run. These only exist if the execution was saved, so keep Save failed production executions turned on in the workflow settings.execution.modeandexecution.retryOf: how it ran, and whether it was a retry
If the failure happens in the trigger node itself (for example an expired credential on a polling trigger), the data arrives under a trigger object instead, with less detail in execution. Use a fallback in your message: {{ $json.execution?.error?.message ?? $json.trigger?.error?.message }}.
Step 2: Retry flaky steps automatically
Many errors fix themselves a few seconds later: a 502 from an API, a rate limit, a slow database. Let n8n try again before anyone gets alerted.
- Open the node that calls the external service (HTTP Request, Google Sheets, an AI model and so on) and go to its Settings tab.
- Turn on Retry On Fail.
- Set Max Tries (3 is a good start) and Wait Between Tries in milliseconds (for example
5000for five seconds).
For APIs with strict rate limits, use a longer wait, or slow the whole workflow down with Loop Over Items and a Wait node. Our HTTP Request tutorial covers calling APIs in more depth.
Step 3: Keep going with the error output
By default one bad item stops the whole run. When you’re processing a list (say 200 contacts), it’s usually better to finish the good ones and set the bad ones aside.
Google Sheets: Get rows
↓
HTTP Request: enrich contact (On Error: Continue (using error output))
↓ success ↓ error
CRM: create contact Google Sheets: append to "Failed" tab
- In the risky node’s Settings, set On Error to Continue (using error output).
- The node now has two outputs. Connect the normal output to the next step as usual.
- Connect the error output to a Google Sheets node that appends the item plus
{{ $json.error.message }}to aFailedtab, so you can fix and re-run just those rows later.
The other options are Stop Workflow (the default) and Continue, which passes the item on with the error attached but no separate branch. Use plain Continue sparingly; it’s easy to miss failures that way.
Step 4: Fail on purpose with Stop And Error
Some problems aren’t technical errors at all. A lead with no email or an order with a negative total won’t break any node, but the result is still wrong. Catch these yourself:
Webhook (new order)
↓
IF: email is empty OR total ≤ 0
↓ true
Stop And Error: "Invalid order {{ $json.order_id }}: missing email or bad total"
- Add an IF node that checks for the bad conditions.
- On the true branch, add a Stop And Error node with a clear message that includes an ID you can search for.
- Because this counts as a failure, your error workflow from Step 1 picks it up and alerts you with that exact message.
In a Code node you can do the same with throw new Error('Invalid order ' + $json.order_id);
Step 5: Let AI explain the error
Error messages like ECONNRESET or 400 Bad Request don’t always say what to do next. Add an AI step to your error workflow:
Error Trigger
↓
OpenAI / Gemini: likely cause + suggested fix (2-3 lines)
↓
Telegram / Slack: alert with the error AND the explanation
- Between the Error Trigger and your alert node, add an OpenAI (or Gemini) node with a prompt like:
You are an n8n expert. Explain this workflow error in 2-3 short lines: the likely cause and the first thing to check. Workflow: {{ $json.workflow.name }}. Node: {{ $json.execution.lastNodeExecuted }}. Error: {{ $json.execution.error.message }} - Add the AI’s answer to your alert message, below the raw error.
Keep the raw error in the alert too. The AI is a helpful first guess, not the final word.
Avoiding alert spam
A workflow that runs every minute can send you 60 identical alerts an hour while an API is down. Two easy fixes:
- Send critical workflows to Telegram or Slack and everything else to a daily email digest. Log each error to a Google Sheet or database from the error workflow, then summarise that log once a day.
- Add a Remove Duplicates node to the error workflow, set to remove items already seen in previous executions, keyed on the workflow name plus error message. Repeats of the same error are then dropped instead of alerting again.
Troubleshooting
- The error workflow never fires: check that it’s published, that it’s selected in the failing workflow’s settings, and that you’re testing with a real run, not a manual test.
execution.urlis empty: the failed execution wasn’t saved. Turn on Save failed production executions in the workflow settings.- Retries don’t help: errors like 401 (bad credentials) or 400 (bad data) won’t fix themselves. Retry only helps with timeouts, 429s and 5xx errors.
- Items vanish silently: a node is set to Continue without an error output. Switch it to Continue (using error output) and route the failures somewhere visible.
- Alert message shows “undefined”: the error came from the trigger node, so the details are under
trigger. Use the fallback expression from Step 1.
Wrapping up
Set up the error workflow today and connect it to every workflow you run in production. Then add retries to anything that calls an outside API, use error outputs for long lists, and add Stop And Error checks wherever bad data could slip through. You’ll hear about problems before your clients do.
Watch the step-by-step builds on our YouTube channel, Node & Volt.


