The n8n error workflow, done properly: useful alerts without the spam
Build an n8n error workflow that tells you what broke and what to do, classifies errors, and mutes repeats so one expired token doesn't flood Slack.
Every production n8n workflow should have an error workflow: a separate workflow, starting with an Error Trigger node, that n8n runs whenever the main workflow fails. You set it per workflow under Settings → Error workflow.
Most first versions send "Workflow X failed" to Slack and stop there. That's better than nothing, but it fails in two predictable ways: the message is too thin to act on, and a single broken credential can produce hundreds of identical messages. Here's how to fix both.
What the Error Trigger gives you
When an execution fails, the Error Trigger receives a payload shaped roughly like this:
{
"execution": {
"id": "231",
"url": "https://n8n.example.com/workflow/1/executions/231",
"retryOf": null,
"error": { "message": "…", "stack": "…" },
"lastNodeExecuted": "HTTP Request",
"mode": "trigger"
},
"workflow": { "id": "1", "name": "Lead intake" }
}
If the failure happened in the trigger node itself (for example a polling trigger that can't connect), the payload has a trigger object with the error instead of execution, and there's no execution URL. Handle both shapes.
Rule 1: make every alert actionable
Put four things in every message:
- Workflow name (and id).
- The node that failed:
execution.lastNodeExecuted. - The error message, trimmed to a few hundred characters.
- The execution link:
execution.url, so you can open it from your phone.
Add a fifth if you can: what to do next. That depends on the kind of error.
Rule 2: classify the error
Most failures fall into a handful of classes, and each class has a different first move:
| Class | Typical signal | First move | Retry? |
|---|---|---|---|
| auth | 401, 403, "invalid_grant", "token expired" | Reconnect or rotate the credential | No |
| rate_limit | 429, "too many requests" | Wait; add backoff or batching | Yes |
| timeout | "timeout of … exceeded" | Check upstream; consider a longer timeout | Yes |
| network | ECONNRESET, ENOTFOUND, ECONNREFUSED | Check DNS / connectivity | Yes |
| upstream_5xx | 500–599 from the API | Check the provider's status page | Yes |
| validation | 4xx, "cannot read properties of undefined" | Fix the data or the mapping | No |
A few lines of JavaScript in a Code node can do this with simple pattern matches on the message, plus the HTTP status where available. One subtlety: when an explicit status code is present, let it win over the message text, because some error messages mention "too many requests" even for 5xx responses.
Rule 3: mute repeats, don't drop them
When a credential expires, every run of that workflow fails the same way. You want one alert, not one per run.
Build a fingerprint for each failure: workflow id + failed node + the error message with volatile parts removed. Lowercase it, then replace UUIDs, timestamps, long ids and numbers with placeholders. "Timeout after 30000ms (request 812)" and "(request 977)" then become the same incident.
Then:
- Store every occurrence (a small database table works well).
- Alert only if the same fingerprint hasn't been alerted in the last N minutes (30 is a sensible default).
- Say in the alert that repeats are being muted, so nobody wonders why it went quiet.
If your storage is down, alert anyway. Losing an alert is worse than sending a duplicate.
Rule 4: send different severities to different places
Not every failure deserves a page. A common split:
- Critical: workflows that move money or customer data. These go to a channel people actually watch.
- High: auth failures. They won't fix themselves.
- Low/medium: transient errors that a retry may resolve. A daily summary is often enough.
Keep a short list of critical workflow ids in the error workflow's config, rather than hard-coding severity into each workflow.
Rule 5: ignore editor test runs
Failures from manual runs in the editor have mode: "manual". Store them if you like, but don't alert on them, or people learn to ignore the channel.
Wiring it up
- Build the error workflow: Error Trigger → Code (normalize + classify + fingerprint) → database insert that returns whether to alert → IF → Slack/Discord/email.
- Activate it.
- Open each production workflow → Settings → Error workflow → select it. This step is easy to forget for new workflows, so check it regularly.
Our free n8n Reliability Audit lists every active workflow that has no error workflow set. It's the single highest-weighted check in the audit. The Error Router in the Reliable Automation Kit implements all five rules above, with Postgres-backed suppression and tests.
Related
n8n 2.20: publish your sub-workflows and error workflow first
In n8n 2.20.8 a published workflow could not run an unpublished sub-workflow or error workflow. What we saw in testing, and an install order that avoids it.
Your n8n workflow stopped running and nothing turned red
The error workflow only fires when a run starts and fails. How to catch dead schedules, disabled webhooks and expired triggers with a silence watchdog.