AutomationFlowsGeneral › Access Execution Data From an Error Workflow

Access Execution Data From an Error Workflow

ByDavid Roberts @davidn8n on n8n.io

Sometimes you want to take a different action in your error workflow based on the data that was flowing through it.

Event trigger★★★★☆ complexity3 nodesError Triggern8n
General Trigger: Event Nodes: 3 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #2349 — we link there as the canonical source.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "meta": {
    "templateId": "2349"
  },
  "nodes": [
    {
      "id": "d9c81685-d16e-45c0-a1ab-3927ef619568",
      "name": "Error Trigger",
      "type": "n8n-nodes-base.errorTrigger",
      "position": [
        380,
        240
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "22089e9b-73ae-4d03-a11b-5f67f9b47fb4",
      "name": "Extract webhook data",
      "type": "n8n-nodes-base.code",
      "position": [
        820,
        240
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const webhook_node_names = $json.workflowData.nodes.filter(x => x.type == 'n8n-nodes-base.webhook').map(x => x.name)\n\nconst webhook_data_array = webhook_node_names.map(n => $json.data.resultData.runData[n] ? $json.data.resultData.runData[n][0].data.main[0][0].json : null).filter(x => x != null)\n\nlet webhook_data = null;\nif (webhook_data_array.length > 0) {\n  webhook_data = webhook_data_array[0]\n}\n\nreturn {\n  'webhook_node_names': webhook_node_names,\n  'webook_node_payload': webhook_data\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "b7fb5443-3faf-4e59-b464-4d3ca131a84f",
      "name": "Get execution data",
      "type": "n8n-nodes-base.n8n",
      "position": [
        600,
        240
      ],
      "parameters": {
        "options": {
          "activeWorkflows": true
        },
        "resource": "execution",
        "operation": "get",
        "executionId": "={{ $json.execution.id }}",
        "requestOptions": {}
      },
      "credentials": {
        "n8nApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Error Trigger": {
      "main": [
        [
          {
            "node": "Get execution data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get execution data": {
      "main": [
        [
          {
            "node": "Extract webhook data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Sometimes you want to take a different action in your error workflow based on the data that was flowing through it.

Source: https://n8n.io/workflows/2349/ — original creator credit. Request a take-down →

More General workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

General

This workflow automatically handles errors in your n8n workflows by: Detecting when an error occurs and capturing the error details Sending an email notification with the error message and affected no

Error Trigger, Email Send, n8n
General

Error N8N. Uses errorTrigger, n8n. Event-driven trigger; 3 nodes.

Error Trigger, n8n
General

Using n8n a lot?

Execute Workflow Trigger, XML, Move Binary Data +1
General

&gt; v2: Now it can read multiple types of LLM usages. Better dynamic approach for reading model usage.

n8n, Execute Workflow Trigger, Stop And Error
General

Self-Hosted n8n Workflow Backup to Google Drive. Uses googleDrive, n8n. Event-driven trigger; 17 nodes.

Google Drive, n8n