n8n's Error Trigger Is Opt-In. My Bot Gate Failed for 71 Hours and Alerted Nobody.
Описание и применение
В n8n обработка ошибок включена по‑по‑рабочему‑потоку, поэтому покрытие может тихо снижаться, приводя к длительным неотслеживаемым сбоям. Автор создал единый обработчик ошибок, добавил SQL‑запрос для аудита защищённых потоков, улучшил сообщения об ошибках и внедрил внешнюю «сердечную» проверку, чтобы обнаруживать потоки, которые не запускаются.
Задача
Error handling in n8n is opt‑in per workflow, so coverage decays silently and critical failures can go unnoticed for days.
Результат
The audit query and single shared error handler reduced silent failure windows from 70.9 hours to near‑real‑time alerts, while the heartbeat monitor added detection of workflows that never start.
Рабочий процесс
- Create one Error Trigger workflow that formats {{ $json.workflow.name }}, {{ $json.execution.id }}, and {{ $json.execution.error.message }} into an alert.
- Run the provided SQL query against the n8n Postgres database (or the Cloud API) to list workflows where settings.errorWorkflow is null or empty.
- Add the Error Trigger workflow as the error handler for each guarded workflow via Settings → Error Workflow.
- Modify alert messages to include the workflow name in the subject line for clearer identification.
- Deploy a separate heartbeat workflow or external cron that pings a monitoring endpoint every run; if the ping fails or is not received within 60 minutes, send a notification.
- Use the heartbeat to detect when a workflow stops running entirely (e.g., deactivated trigger, dead cron, or worker failure).
Доказательства
Error handling in n8n is opt‑in per workflow, so coverage decays silently and critical failures can go unnoticed for days.
I pulled the failures of my own internal workflows, grouped by workflow, with a column for whether that workflow had an error handler attached:
The query is now the first line of my weekly runbook, next to the backup check.
That is the whole value proposition of the Error Trigger, and it is not "fewer failures." It is failures that end in hours instead of days.
- Дата записи: 2026-10-22T17:11:24.078Z