DEV Community

Robert Breen
Robert Breen

Posted on Originally published at learn.ynteractive.com

n8n: Get Alerted When an Automation Fails, Before a Client Notices

A silent failure costs more than an error. Say your n8n workflow pulls prices from a sheet every morning, and one run fails on a Monday. Nobody gets an email, the quote tool keeps using last week's prices, and a client gets the wrong number. You find out when they call.

The business case is simple: a failed run should tell a person within minutes, and a step that fails for a passing reason should retry on its own.

Two settings do most of the work

  1. Retry On Fail. Open the step that sometimes fails, such as an HTTP request or a Gmail send, and turn on Retry On Fail. Set a short wait between attempts. Temporary errors, like a timeout, often clear on the second try.
  2. An error workflow. Build a second workflow that starts with the Error Trigger node. When any workflow fails, it runs, reads the failed workflow's name and the error message, and sends one email or chat message.

Build it

  • Create the error workflow with an Error Trigger.
  • Add a Gmail or Slack node that sends the workflow name, the time and the error text to someone who can act on it.
  • Open each important workflow's settings and choose this error workflow.
  • Run a test failure on purpose, check that the alert arrives, then delete the test.

Do not hide the problem

Retries can make a bad step look fine when it is not. If the same step fails three times in a row, that is an alert, not a success. Keep the alert, and fix the cause.

The free lesson walks through each click in a practice copy of n8n, about 10 minutes:
https://learn.ynteractive.com/content/n8n-error-handling-retry-on-fail-error-workflow

Disclosure: I run Stepthrough, which publishes these free lessons.

Top comments (0)