> For the complete documentation index, see [llms.txt](https://doc.duaer.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.duaer.com/flow-logic/error-handling.md).

# Handle errors gracefully in Duaer

How to handle execution errors in Duaer.
## How do you set up an error workflow?

For each workflow, you can set an error workflow in Settings. It runs if a production execution fails. You can, for example, send email or Slack alerts. The error workflow must start with Error Trigger. You can use the same error workflow for several workflows.

1. Create a new workflow with Error Trigger as the first node.
2. Give it a name, for example Error Handler, and select Save.
3. In the workflow that should use it, open Options → Settings.
4. Under Error workflow, select the workflow you just created, then Save. When that workflow fails in production, the error workflow runs.

A failed manual test on the canvas does not start Error Trigger. On Error on a node (stop, continue, or use the error output) controls the path inside the same run. That is separate from the error workflow.

## What data does an error workflow receive?

The default error data received by the Error Trigger is:

```
[
	{
		"execution": {
			"id": "231",
			"url": "https://duaer.example.com/execution/231",
			"retryOf": "34",
			"error": {
				"message": "Example Error Message",
				"stack": "Stacktrace"
			},
			"lastNodeExecuted": "Node With Error",
			"mode": "manual"
		},
		"workflow": {
			"id": "1",
			"name": "Example workflow"
		}
	}
]
```

All information is usually present, except: execution.id and execution.url require the execution to be saved in the database (they may be missing if the trigger node of the main workflow fails). execution.retryOf is only present when the execution is a retry of a failed execution.

Use Stop and Error to force an execution to fail and start the error workflow. Retry On Fail only retries the same node for short failures. It is not a second error workflow.
## Questions

### How do you attach error handling to a workflow in Duaer?

Create a workflow that starts with Error Trigger, then select it under Settings → Error workflow on the workflow you want to protect. Only failed production executions start it; a failed manual test does not. On Error on a node controls the path inside the same run and is separate from the error workflow.

### Is Retry On Fail the same as an error workflow in Duaer?

No. Retry On Fail retries the same node. An error workflow is a different flow that starts only after a production execution has already failed.

