New Tool Radar

AI Agents & Automation

How to Add an Error Trigger Workflow to an n8n AI Agent

Add an error trigger workflow to an n8n AI agent so a failed run alerts a person instead of failing silently.

Schematic with three steps: Create a workflow with an Error Trigger; Post the failure details to a person; Break the agent on purpose and check.

An AI agent workflow fails in ways a fixed workflow rarely does: a model call times out, a tool returns an error, or the output does not fit the parser. n8n has an Error Trigger that starts a separate workflow when another workflow errors, so you can post an alert with the failing run details. Without it, a broken agent fails quietly and nobody finds out until a user complains.

What you need

  • An n8n AI agent workflow that already runs
  • A Slack channel or email address for failure alerts
  • The name of the workflow the error workflow should watch

Step 1: Create a workflow with an Error Trigger

Create a new workflow and add an Error Trigger node as its first step. This workflow starts automatically when a watched workflow errors.

Step 2: Post the failure details to a person

Add a Slack or Gmail node that sends the failing workflow name, the error message and the time, so the person reading the alert knows which run broke and why.

Step 3: Break the agent on purpose and check the alert

Force a failure, for example by disconnecting a tool credential, and run the agent workflow. Confirm the alert arrives with the right workflow name and error, then reconnect the credential.

Worked example: synthetic forced failure

The table below is a synthetic example. It shows the expected result of the error path; no failure was forced.

Check Expected Result
Agent run fails Yes, forced Pass
Alert arrives Within a minute Pass
Alert names the workflow Yes Pass
Alert includes the error Yes Pass

Expected result (UNTESTED). the forced failure starts the error workflow, and the alert names the broken workflow and its error. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • The error workflow only fires for errors in the workflows it watches, so check which workflows are covered.
  • An alert that only says something failed is not useful; include the workflow name and the error message.
  • Test the error path on purpose, because an untested error workflow is just a guess.

Sources

See all