n8n Error Handling Pattern¶
Standardized error management ensures that failed workflows are visible, logged, and actionable.
What problem it solves¶
In complex automation stacks, workflows can fail due to API rate limits, network issues, or malformed data. Without standardized error handling, these failures often go unnoticed (silent failures).
Core Components¶
1. Error Trigger Node¶
Every production workflow should include an Error Trigger node. This node catches any unhandled error within the workflow.
2. Standardized Error Sub-workflow¶
Instead of handling errors locally in every workflow, use an "Error Handler" sub-workflow. - Input: Error details (Workflow Name, Error Message, Node Name, Timestamp). - Actions: - Log to a centralized database or file. - Send a notification to a human review channel (e.g., Gotify, NTFY, or a dedicated "Failed Tasks" board). - Optionally, trigger a retry if the error is transient.
Implementation Guide¶
- Create a global
Error Handlerworkflow. - In your primary workflow, add the
Error Triggernode. - Connect the
Error Triggerto anExecute Workflownode that calls theError Handler.
Sources / References¶
Contribution Metadata¶
- Last reviewed: 2026-04-18
- Confidence: high
Research: Error Visualization Tools¶
To close the visibility gap, two primary paths are recommended for visualizing n8n errors:
1. Home Assistant (Incident Response Focus)¶
- Best for: Immediate visibility and real-time alerts in the homelab.
- Implementation: n8n pushes error details to HA via the REST API or MQTT. A dedicated dashboard view (e.g., using a Markdown Card) displays the last few failed workflows.
- Pros: Low latency, integrated with home notifications, easy to set up.
2. Grafana (Analytics & Trends Focus)¶
- Best for: Analyzing failure patterns over weeks or months.
- Implementation: n8n logs error metadata to a database (InfluxDB or PostgreSQL). Grafana provides high-fidelity charts and heatmaps.
- Pros: Professional-grade analytics, handles high volume easily.
Standardized Error Schema¶
To ensure consistency across the stack, the following schema must be used when passing error data to the centralized queue:
| Field | Type | Description |
|---|---|---|
| status | String | Always failed for errors. |
| model | String | (Optional) The LLM model being used when the failure occurred. |
| workflow_id | String | The unique ID of the failing n8n workflow. |
| node_name | String | The specific node that triggered the error. |
| timestamp | ISO8601 | The exact time of the failure. |
| message | String | The human-readable error message. |
Reference Implementation: Home Assistant Dashboard¶
To visualize the error queue in Home Assistant, use a Markdown Card in your dashboard. This card parses the attributes of the sensor.n8n_error_queue created by the reference n8n workflow.
Dashboard Card (Markdown)¶
type: markdown
title: n8n Error Queue
content: >
**Status**: {{ state_attr('sensor.n8n_error_queue', 'status') }}
**Message**: {{ states('sensor.n8n_error_queue') }}
**Workflow ID**: {{ state_attr('sensor.n8n_error_queue', 'workflow_id') }}
**Failed Node**: {{ state_attr('sensor.n8n_error_queue', 'node_name') }}
**Last Occurred**: {{ state_attr('sensor.n8n_error_queue', 'timestamp') }}
Manual Configuration (configuration.yaml)¶
If you prefer to define the sensor manually to ensure it exists before the first n8n push:
template:
- sensor:
- name: "n8n Error Queue"
unique_id: n8n_error_queue
state: "No errors"
attributes:
status: "healthy"
workflow_id: "none"
node_name: "none"
timestamp: "N/A"