---
contentType: howto
description: How to handle execution errors.
nodeTitle: Handle errors gracefully
originalFilePath: flow-logic/error-handling.md
originalUrl: 'https://docs.n8n.io/flow-logic/error-handling'
url: 'https://docs.n8n.io/build/flow-logic/handle-errors-gracefully'
layout:
description:
visible: false
---
# Error handling
When designing your [flow logic](./), it's a good practice to consider potential errors, and set up methods to handle them gracefully. With an error workflow, you can control how n8n responds to a workflow execution failure.
{% hint style="info" %}
**Investigating errors**
To investigate failed executions, you can:
* Review your [Executions](../understand-workflows/understand-executions/README.md), for a [single workflow](../understand-workflows/understand-executions/view-executions-for-a-single-workflow.md) or [all workflows you have access to](../understand-workflows/understand-executions/view-all-executions.md). You can [load data from previous execution](../understand-workflows/understand-executions/debug-executions.md) into your current workflow.
* Enable [Log streaming](https://app.gitbook.com/s/wMJrGrimpx3PxCJpUswm/observe-and-log/stream-logs-to-external-systems).
{% endhint %}
## How do I set up an error workflow?
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. The error workflow must start with the [Error Trigger](https://app.gitbook.com/s/BKcbOzIWja8NfqKDcqHc/builtin/core-nodes/n8n-nodes-base.errortrigger).
You can use the same error workflow for multiple workflows.
{% include "https://app.gitbook.com/s/GixZThfitWP21x2gQFpD/~/reusable/odStQfuU7M0KPowwye9k/" %}
## What data does an error workflow receive?
{% include "https://app.gitbook.com/s/GixZThfitWP21x2gQFpD/~/reusable/rAiMowL1bA7C4GcH8FyS/" %}
## How do I make a workflow fail on purpose with the Stop and Error node?
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](https://app.gitbook.com/s/BKcbOzIWja8NfqKDcqHc/builtin/core-nodes/n8n-nodes-base.stopanderror) node to your workflow to force executions to fail under your chosen circumstances, and trigger the error workflow.
## Related resources
* [Flow logic](./)
* [Split with conditionals](split-with-conditionals.md)
* [Merge data](merge-data.md)
* [Loop](loop.md)
* [Wait](wait.md)
* [Understand execution order](understand-execution-order.md)
* [Break workflows into smaller parts](break-workflows-into-smaller-parts.md)
* [Convert to sub-workflows](convert-to-sub-workflows.md)