For each workflow, you can set an error workflow in Workflow Settings. It runs if an execution fails. This means you can, for example, send email or Slack alerts when a workflow execution errors.
You can use the same error workflow for multiple workflows.
Create and set an error workflow#
- Create a new workflow, with the Error Trigger as the first node.
- Give the workflow a name, for example
- Select Save.
- In the workflow where you want to use this error workflow:
- Select Options > Settings.
- In Error workflow, select the workflow you just created. For example, if you used the name Error Handler, select Error handler.
- Select Save. Now, when this workflow errors, the related error workflow runs.
The default error data received by the Error Trigger is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
All information is always present, except:
execution.id: requires the execution to be saved in the database.
execution.url: requires the execution to be saved in the database.
execution.retryOf: only present when the execution is a retry of a failed execution.
Cause a workflow execution failure using Stop And Error#
When you create and set an error workflow, n8n runs it when an execution fails. Usually, this is due to things like errors in node settings, or the workflow running out of memory.
You can add the Stop And Error node to your workflow to force executions to fail under your chosen circumstances, and trigger the error workflow.