Error Handling: Retrieve Failed Execution and Webhook Data - n8n Workflow

Use this essential n8n workflow template for robust error recovery. Automatically trigger on failure, retrieve full execution data, and extract the original Webhook payload for reliable debugging and reprocessing.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Automation Developers: Individuals building complex n8n workflows who require guaranteed logging and debugging capabilities.
System Administrators: Those needing proactive monitoring of automated processes.
Anyone Using Webhooks as Triggers: Users who rely on incoming data integrity and need to reprocess failed requests easily.
n8n Power Users: Anyone looking for advanced examples of how to utilize the internal n8n node for DevOps and monitoring.

Overview

When a primary n8n workflow fails, developers often need to know exactly what input caused the failure. This specialized n8n workflow template solves the crucial problem of data recovery in failure scenarios. It utilizes the powerful Error n8n trigger to instantly initiate a recovery process whenever an execution fails. By using the internal n8n node, this n8n workflow fetches the complete history of the failed execution. Crucially, it then uses custom scripting to locate and extract the specific payload received by the Webhook n8n node, ensuring that no request data is lost. This is a foundational piece of any resilient n8n automation strategy, offering superior debugging insight compared to relying solely on logs.

How it Works

This resilient n8n workflow operates entirely in response to failure:


  1. Error n8n Trigger: The flow starts with the Error Trigger n8n node. Unlike standard n8n templates, this n8n workflow must be configured as the designated Error Workflow for your primary (failing) workflows. It automatically receives metadata about the failed execution.

  2. Get Execution Data: The workflow then utilizes the n8n node configured to access the internal n8n API. It requests the full execution record using the execution.id passed from the trigger.

  3. Extract Webhook Data: A subsequent Code n8n node processes the massive execution data structure. Its primary function is to iterate through the history of the failed workflow, identify all Webhook n8n nodes, and locate the actual incoming JSON payload that initiated the failed run.

  4. Final Action (Implicit): Once the data is extracted (now available as a clear JSON object), you can seamlessly integrate it with logging tools (like Slack or Email), store it in a database, or queue it for manual inspection or reprocessing. This robust n8n workflow ensures critical context is never lost.

Installation Guide

To deploy this n8n workflow and start monitoring your other processes, follow these steps:


  1. Import: Copy the JSON provided and import it directly into your n8n instance.

  2. Activate API Credentials: Locate the 'Get execution data' n8n node. You must configure or select existing n8n API Credentials here. These credentials allow this n8n workflow to communicate with your self-hosted or cloud n8n instance to pull execution history.

  3. Enable as Error Workflow: Save and activate this n8n workflow. Then, go to the settings of the primary n8n workflow you wish to monitor, navigate to the 'Error Workflow' section, and select this newly imported n8n workflow as the designated error handler.

  4. Testing: To confirm it works, run the primary n8n workflow and intentionally cause an error (e.g., provide invalid input to a critical n8n node). This error n8n workflow should automatically trigger and populate data.

Node Details

Error Trigger n8n node:
Function: This unique n8n trigger node starts the recovery process. It is configured to run only when another execution fails, providing immediate metadata about the incident.
Key Configuration: None needed beyond activation; its configuration relies on being selected as the global or specific error workflow.

n8n Node (Get execution data):
Function: Communicates with the internal n8n API to retrieve the entire execution object of the failed run, including all node inputs and outputs.
Key Configuration: Resource: Execution, Operation: Get, Execution ID: {{ $json.execution.id }}. It relies on the execution ID passed by the Error n8n trigger.

Code n8n node (Extract webhook data):
Function: Processes the large JSON structure from the previous n8n node to programmatically locate and extract the raw payload received by the Webhook n8n node that started the failed flow. This is a vital step for debugging.
* Key Configuration: Custom JavaScript logic is used to filter workflow nodes by type ('n8n-nodes-base.webhook') and retrieve the corresponding run data results.

Related n8n Workflows

Free

Nodes: 3 Nodes
Updated: December 26 2025
View all
Created by
David Roberts
David Roberts

Featured*