Foundations

A reusable n8n error handler workflow

An Error Trigger, a Set node that builds a subject and body from the failed execution, and an HTTP Request that posts it to a Slack incoming webhook.

Trigger
Error Trigger, fired by any workflow that selects this one as its error workflow
Nodes
3
Requires
No external credentials
Category
Foundations
From the course
n8n Workflow Foundations
Published
2026-09-10

Node types used

  • Error Trigger
  • Edit Fields (Set)
  • HTTP Request
Workflow diagram: A reusable n8n error handler workflowError TriggerAlertNotify
TriggerAction

What it does

A workflow that fails at 04:00 fails silently. n8n records the execution and moves on, and you find out days later when the data that should have arrived is not there. The fix is one small workflow that every other workflow points at, and it takes about five minutes to build once.

An Error Trigger starts the run. n8n calls it with a single item describing the failure, and a Set node picks the useful parts out of that item: a subject line of "n8n failed:" plus $json.workflow.name, and a body containing $json.execution.lastNodeExecuted, $json.execution.error.message and $json.execution.url so the message links straight back to the failed run. An HTTP Request node POSTs a JSON body built from those two fields to a Slack incoming webhook URL. The node carries a note explaining that Slack expects the key "text" and Discord expects "content", so pointing this at Discord without changing the key returns a 400.

It notifies, and that is all. It does not retry the failed workflow, group repeated failures or decide that some errors matter more than others.

Node by node

  1. 1

    Error Trigger Fires when a workflow that names this one as its error workflow fails. The incoming item carries workflow.name plus execution.lastNodeExecuted, execution.error.message and execution.url.

  2. 2

    Alert A Set node producing two string fields: subject as "n8n failed: {{ $json.workflow.name }}", and body as the last node executed, the error message, and the execution URL on the next line.

  3. 3

    Notify POSTs to a Slack incoming webhook with a JSON body of { "text": subject + newline + body }. The node note points out that Discord wants the key "content" instead, and that a Send Email node can replace this node entirely.

Setup after import

  1. 1

    Create a Slack incoming webhook and replace the placeholder URL https://hooks.slack.com/services/REPLACE/WITH/YOUR-WEBHOOK on the Notify node.

  2. 2

    If you would rather use Discord, change the JSON body key from text to content. Discord returns a 400 for text.

  3. 3

    If you would rather have email, swap the Notify node for a Send Email node and use the subject and body fields the Set node already produces.

  4. 4

    Save and activate the workflow, then open every workflow you care about, go to Settings, and select this one under Error Workflow. It does nothing until something points at it.

  5. 5

    Test it by adding a Stop and Error node to a scratch workflow and running it.

Limits

  • Notification only. No retry and no recovery.

  • One message per failure, so a workflow failing in a loop is noisy.

  • The webhook URL sits in the node rather than in a credential, so keep the export private once you have pasted your own.

  • An Error Trigger does not fire for a workflow that was never started, such as a schedule that did not run because n8n was down.

Download the workflow

The 3 node export as n8n reads it. Credential ids, personal values and real endpoints are replaced with placeholders, so nothing here can reach an account that is not yours. No email, no account.

Download n8n-error-handler-workflow.json

Get help with this in the community

If the import fails, if a node errors on the first run, or if you want to point this at a service it does not cover yet, post it in the free House of Loops community. Say which template it is and paste the error. Shannon Atkinson answers, and the answer stays there for the next person who hits the same thing.

Ask in the community