This workflow corresponds to n8n.io template #15484 — we link there as the canonical source.
This workflow follows the Agent → Error Trigger recipe pattern — see all workflows that pair these two integrations.
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 →
{
"id": "x1ix9WUpO9c7YSGs",
"name": "AI Error diagnosis system",
"tags": [],
"nodes": [
{
"id": "aaacdc9b-2da5-456b-a7c3-03ee7071abdc",
"name": "IF \u2014 Confidence \u2265 80?",
"type": "n8n-nodes-base.if",
"position": [
3168,
144
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "confidence-gte-80",
"operator": {
"type": "number",
"operation": "gte"
},
"leftValue": "={{ $json.validated_confidence }}",
"rightValue": 80
}
]
}
},
"typeVersion": 2
},
{
"id": "425cc8f0-1cb5-4703-836f-96ea6c48a608",
"name": "IF \u2014 Confidence \u2265 50?",
"type": "n8n-nodes-base.if",
"position": [
3408,
240
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "confidence-gte-50",
"operator": {
"type": "number",
"operation": "gte"
},
"leftValue": "={{ $json.validated_confidence }}",
"rightValue": 50
}
]
}
},
"typeVersion": 2
},
{
"id": "3f4f3d9d-3131-4dc7-b803-5259a9b1295d",
"name": "Claude Scoring Judge",
"type": "@n8n/n8n-nodes-langchain.agent",
"maxTries": 2,
"position": [
2208,
144
],
"parameters": {
"text": "=You are an expert evaluator of AI-generated n8n workflow error diagnoses.\nYou will receive a diagnosis generated by another AI agent. Your job is to\nindependently evaluate the quality of that diagnosis and validate or correct\nthe confidence score.\n\nDIAGNOSIS TO EVALUATE:\ndirect_cause: {{ $('Claude Diagnosis').first().json.output.direct_cause }}\nunderlying_cause: {{ $('Claude Diagnosis').first().json.output.underlying_cause }}\ntiming_analysis: {{ $('Claude Diagnosis').first().json.output.timing_analysis }}\nfix: {{ JSON.stringify($('Claude Diagnosis').first().json.output.fix) }}\nprevention: {{ $('Claude Diagnosis').first().json.output.prevention }}\nerror_type: {{ $('Claude Diagnosis').first().json.output.error_type }}\nself_reported_confidence: {{ $('Claude Diagnosis').first().json.output.confidence }}\nis_recurring: {{ $('Claude Diagnosis').first().json.output.is_recurring }}\n\nORIGINAL ERROR CONTEXT:\nWorkflow name: {{ $('Code - Prepare context').first().json.workflow_name }}\nError message: {{ $('Code - Prepare context').first().json.error_message }}\nFailing node name: {{ $('Code - Prepare context').first().json.error_node.name }}\nFailing node type: {{ $('Code - Prepare context').first().json.error_node.type }}\nFailing node parameters: {{ JSON.stringify($('Code - Prepare context').first().json.error_node.parameters) }}\nBusiness action: {{ $('Code - Prepare context').first().json.business_context.business_action }}\nHistorical context: ={{ $('Code - Prepare context').first().json.historical_context.filter(h => h.direct_cause !== null).length > 0 ? JSON.stringify($('Code - Prepare context').first().json.historical_context.filter(h => h.direct_cause !== null)) : 'No historical data available.' }}\n\nEVALUATION RUBRIC \u2014 score each criterion yes or no:\n1. Is the direct_cause specific (not generic like \"the node failed\")?\n2. Is the underlying_cause different from the direct_cause and more insightful?\n3. Does the error_type correctly match the described cause?\n4. Is the self_reported_confidence realistic given the available context?\n\nRespond with valid JSON only. No markdown. No explanation. No code fences.\nUse this exact structure:\n{\n \"validated_confidence\": 0-100,\n \"confidence_adjustment_reason\": \"one sentence explaining why you adjusted or kept the confidence score\"\n}\n\nRules for validated_confidence:\n- If all 4 criteria pass: increase self_reported_confidence by max 5 points\n- If 3 criteria pass: keep self_reported_confidence unchanged\n- If 2 criteria pass: lower self_reported_confidence by 10-15 points\n- If 1 criterion passes: lower self_reported_confidence by 15-25 points\n- Never set validated_confidence above 95",
"options": {
"maxIterations": 3
},
"promptType": "define",
"needsFallback": true,
"hasOutputParser": true
},
"retryOnFail": true,
"typeVersion": 3.1,
"waitBetweenTries": 5000
},
{
"id": "6f49a0b5-1a8b-47fc-9a18-7b6cd21345f2",
"name": "Claude Diagnosis",
"type": "@n8n/n8n-nodes-langchain.agent",
"maxTries": 2,
"position": [
1728,
144
],
"parameters": {
"text": "=SECTION 1 \u2014 ROLE\nYou analyze failures in automated n8n business workflows.\nYour task is NOT to describe the technical error.\nYour task is to reason about WHY this workflow failed.\nAlways distinguish: direct cause, underlying cause, timing reason.\n\nSECTION 2 \u2014 BUSINESS CONTEXT\nWorkflow name: {{ $('Code - Prepare context').first().json.workflow_name }}\nFailing node: {{ $('Code - Prepare context').first().json.error_node.name }} \n (type: {{ $('Code - Prepare context').first().json.error_node.type }} \n v{{ $('Code - Prepare context').first().json.error_node.typeVersion }})\nLast successful node: {{ $('Code - Prepare context').first().json.lastNodeExecuted }}\nError message: {{ $('Code - Prepare context').first().json.error_message }}\nError name: {{ $('Code - Prepare context').first().json.error_name }}\nError context: {{ JSON.stringify($('Code - Prepare context').first().json.error_context) }}\nAdditional error messages: {{ JSON.stringify($('Code - Prepare context').first().json.error_messages) }}\nNode parameters: {{ JSON.stringify($('Code - Prepare context').first().json.error_node.parameters) }}\nExecution URL: {{ $('Code - Prepare context').first().json.execution_url }}\nBusiness action: {{ $('Code - Prepare context').first().json.business_context.business_action }}\nSuccess looks like: {{ $('Code - Prepare context').first().json.business_context.success_looks_like }}\nKnown failure modes: {{ $('Code - Prepare context').first().json.business_context.known_failure_modes }}\nRun frequency: {{ $('Code - Prepare context').first().json.business_context.run_frequency }}\nExternal dependencies: {{ $('Code - Prepare context').first().json.business_context.external_dependencies }}\n\nSECTION 3 \u2014 WORKFLOW STRUCTURE\n{{ JSON.stringify($('Code - Prepare context').first().json.workflow_json) }}\n\nSECTION 4 \u2014 HISTORICAL CONTEXT\nIf historical diagnoses are present below, use them to identify recurring patterns.\nNote if the same error_type or direct_cause appears multiple times.\n={{ $('Code - Prepare context').first().json.historical_context.filter(h => h.direct_cause !== null).length > 0 \n ? JSON.stringify($('Code - Prepare context').first().json.historical_context.filter(h => h.direct_cause !== null))\n : 'No historical data available for this workflow.' }}\n\nSECTION 5 \u2014 OUTPUT INSTRUCTION\nRespond with valid JSON only. No markdown. No explanation. No code fences.\nUse this exact structure:\n{\n \"direct_cause\": \"specific technical reason the node failed\",\n \"underlying_cause\": \"root cause behind the direct cause\",\n \"timing_analysis\": \"why this happened now vs other times\",\n \"fix\": \"1. First step starting with a verb. 2. Second step starting with a verb. 3. Third step starting with a verb.\",\n \"prevention\": \"how to prevent this in future\",\n \"error_type\": \"auth|network|data|logic|rate_limit|config\",\n \"confidence\": 0-100,\n \"is_recurring\": true ONLY if BOTH the same error_type AND a highly similar direct_cause appear in historical context. If only the error_type matches but the direct_cause is different, set to false\n}\n\nFix must be a single string with maximum 3 numbered steps.\nEach step must start with a verb and be understandable for a non-technical business owner.\n\nProvide your raw honest confidence score (0-100) based purely on how well\nthe available data supports your diagnosis. Do not overthink this \u2014 the\nscore will be independently validated.",
"options": {
"maxIterations": 3
},
"promptType": "define",
"needsFallback": true,
"hasOutputParser": true
},
"retryOnFail": true,
"typeVersion": 3.1,
"waitBetweenTries": 5000
},
{
"id": "1d3c0dbc-d8b7-4b2d-be6a-2df53404d565",
"name": "Structured Output Parser 2",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
2448,
368
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"validated_confidence\": { \"type\": \"number\", \"minimum\": 0, \"maximum\": 100 },\n \"confidence_adjustment_reason\": { \"type\": \"string\" }\n },\n \"required\": [\"validated_confidence\", \"confidence_adjustment_reason\"]\n}"
},
"typeVersion": 1.3
},
{
"id": "d47244ee-7d8f-4fa0-a255-1d266433a048",
"name": "Haiku 4.5 fallback 2",
"type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
"position": [
2288,
368
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "claude-haiku-4-5-20251001",
"cachedResultName": "Claude Haiku 4.5"
},
"options": {
"maxTokensToSample": 1024
}
},
"credentials": {
"anthropicApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "375c0539-9586-4343-80da-df78dcad81b0",
"name": "Haiku 4.5 fallback 1",
"type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
"position": [
1808,
368
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "claude-haiku-4-5-20251001",
"cachedResultName": "Claude Haiku 4.5"
},
"options": {
"maxTokensToSample": 1024
}
},
"credentials": {
"anthropicApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "513403c8-d4ea-4b3c-878c-99c0c1a99f6c",
"name": "Sonnet 4.6 - 2",
"type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
"position": [
2144,
368
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "claude-sonnet-4-6",
"cachedResultName": "Claude Sonnet 4.6"
},
"options": {
"maxTokensToSample": 1024
}
},
"credentials": {
"anthropicApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "7f1f5929-94d9-464e-b7da-eeedd4a18113",
"name": "Sonnet 4.6 - 1",
"type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
"position": [
1664,
368
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "claude-sonnet-4-6",
"cachedResultName": "Claude Sonnet 4.6"
},
"options": {
"maxTokensToSample": 1024
}
},
"credentials": {
"anthropicApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "a49dd4ed-f407-47b7-97d1-408bc1721ed8",
"name": "If",
"type": "n8n-nodes-base.if",
"position": [
832,
160
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "555b02fc-d830-4e9d-aef1-113af93a5c96",
"operator": {
"type": "string",
"operation": "notEmpty",
"singleValue": true
},
"leftValue": "={{ $('Code - Build context').item.json.business_context.business_action }}",
"rightValue": "filled"
},
{
"id": "c3339e49-1d32-4cb2-aa12-b9cf5c4a47a0",
"operator": {
"type": "string",
"operation": "notEmpty",
"singleValue": true
},
"leftValue": "={{ $json.id }}",
"rightValue": "={{ $json.id }}"
}
]
}
},
"typeVersion": 2.3
},
{
"id": "3f910b22-3283-49d3-bdd4-f95a9936f464",
"name": "Supabase - Get historical context",
"type": "n8n-nodes-base.supabase",
"position": [
1232,
144
],
"parameters": {
"filters": {
"conditions": [
{
"keyName": "workflow_id",
"keyValue": "={{ $('HTTP Request - Get workflow JSON').item.json.id }}",
"condition": "eq"
}
]
},
"tableId": "error_log",
"matchType": "allFilters",
"operation": "getAll",
"returnAll": true
},
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 1,
"continueOnFail": true,
"waitBetweenTries": 5000
},
{
"id": "af3f86a6-7865-4d13-bd98-605b6cfcea66",
"name": "Code - Prepare context",
"type": "n8n-nodes-base.code",
"position": [
1456,
144
],
"parameters": {
"jsCode": "const webhook = $('Code - Build context').first().json;\nconst workflow_id = webhook.workflow_id ?? null;\nconst workflow_name = webhook.workflow_name ?? null;\nconst error_message = webhook.error_message ?? null;\nconst error_name = webhook.error_name ?? null;\nconst error_description = webhook.error_description ?? null;\nconst error_stack = webhook.error_stack ?? null;\nconst error_messages = Array.isArray(webhook.error_messages) ? webhook.error_messages : [];\nconst error_context = (webhook.error_context && typeof webhook.error_context === 'object') ? webhook.error_context : {};\nconst error_node = (webhook.error_node && typeof webhook.error_node === 'object') ? webhook.error_node : { name: null, type: null, typeVersion: null, parameters: {} };\nconst lastNodeExecuted = webhook.lastNodeExecuted ?? null;\nconst execution_id = webhook.execution_id ?? null;\nconst execution_mode = webhook.execution_mode ?? null;\nconst execution_url = webhook.execution_url ?? null;\nconst business_context = (webhook.business_context && typeof webhook.business_context === 'object') ? webhook.business_context : {};\nconst workflow_json = webhook.workflow_json ?? null;\nconst technical_email = webhook.technical_email ?? null;\nconst from_email = webhook.from_email ?? null;\n\nlet historical_context = [];\ntry {\n const supabaseItems = $('Supabase - Get historical context').all();\n if (Array.isArray(supabaseItems) && supabaseItems.length > 0) {\n historical_context = supabaseItems\n .filter(item => item && item.json)\n .map(item => ({\n created_at: item.json.created_at ?? null,\n direct_cause: item.json.direct_cause ?? null,\n underlying_cause: item.json.underlying_cause ?? null,\n error_type: item.json.error_type ?? null,\n validated_confidence: item.json.validated_confidence ?? null,\n is_recurring: item.json.is_recurring ?? null,\n error_message: item.json.error_message ?? null,\n fix: item.json.fix ?? null,\n }))\n .sort((a, b) => new Date(b.created_at) - new Date(a.created_at))\n .slice(0, 3);\n }\n} catch (e) {\n historical_context = [];\n}\n\nreturn [{\n json: {\n workflow_id,\n workflow_name,\n error_message,\n error_name,\n error_description,\n error_stack,\n error_messages,\n error_context,\n error_node,\n lastNodeExecuted,\n execution_id,\n execution_mode,\n execution_url,\n business_context,\n workflow_json,\n technical_email,\n from_email,\n historical_context\n }\n}];"
},
"typeVersion": 2
},
{
"id": "001ed8fd-4a58-40ac-abf2-c3e076098e78",
"name": "Structured Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
1968,
368
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"direct_cause\": { \"type\": \"string\" },\n \"underlying_cause\": { \"type\": \"string\" },\n \"timing_analysis\": { \"type\": \"string\" },\n \"fix\": { \"type\": \"string\" },\n \"prevention\": { \"type\": \"string\" },\n \"error_type\": { \"type\": \"string\", \"enum\": [\"auth\", \"network\", \"data\", \"logic\", \"rate_limit\", \"config\"] },\n \"confidence\": { \"type\": \"number\", \"minimum\": 0, \"maximum\": 100 },\n \"is_recurring\": { \"type\": \"boolean\" }\n },\n \"required\": [\"direct_cause\", \"underlying_cause\", \"timing_analysis\", \"fix\", \"prevention\", \"error_type\", \"confidence\", \"is_recurring\"]\n}"
},
"typeVersion": 1.3
},
{
"id": "76fb7a45-1f3a-439d-a8bb-aefd74a7bf9a",
"name": "Code - Merge output",
"type": "n8n-nodes-base.code",
"position": [
2672,
144
],
"parameters": {
"jsCode": "const diagnosis = $('Claude Diagnosis').first().json.output;\nconst scoring = $('Claude Scoring Judge').first().json.output;\nconst context = $('Code - Prepare context').first().json;\n\nconst raw_validated = scoring.validated_confidence ?? 0;\nconst validated_confidence = Math.min(100, Math.max(0, raw_validated));\n\nreturn [{\n json: {\n direct_cause: diagnosis.direct_cause,\n underlying_cause: diagnosis.underlying_cause,\n timing_analysis: diagnosis.timing_analysis,\n fix: diagnosis.fix,\n prevention: diagnosis.prevention,\n error_type: diagnosis.error_type,\n is_recurring: diagnosis.is_recurring,\n self_reported_confidence: diagnosis.confidence,\n validated_confidence: validated_confidence,\n confidence_adjustment_reason: scoring.confidence_adjustment_reason,\n technical_email: context.technical_email,\n from_email: context.from_email,\n workflow_id: context.workflow_id,\n workflow_name: context.workflow_name,\n error_message: context.error_message,\n error_node: context.error_node,\n execution_id: context.execution_id,\n execution_mode: context.execution_mode,\n execution_url: context.execution_url,\n lastNodeExecuted: context.lastNodeExecuted,\n error_stack: context.error_stack,\n business_context: context.business_context\n }\n}];"
},
"typeVersion": 2
},
{
"id": "6b551f54-ea0d-42de-9def-30667e332cbb",
"name": "Supabase - Save diagnosis",
"type": "n8n-nodes-base.supabase",
"position": [
2896,
144
],
"parameters": {
"tableId": "error_log",
"fieldsUi": {
"fieldValues": [
{
"fieldId": "direct_cause",
"fieldValue": "={{ $json.direct_cause }}"
},
{
"fieldId": "underlying_cause",
"fieldValue": "={{ $json.underlying_cause }}"
},
{
"fieldId": "timing_analysis",
"fieldValue": "={{ $json.timing_analysis }}"
},
{
"fieldId": "fix",
"fieldValue": "={{ $json.fix }}"
},
{
"fieldId": "prevention",
"fieldValue": "={{ $json.prevention }}"
},
{
"fieldId": "error_type",
"fieldValue": "={{ $json.error_type }}"
},
{
"fieldId": "is_recurring",
"fieldValue": "={{ $json.is_recurring }}"
},
{
"fieldId": "self_reported_confidence",
"fieldValue": "={{ $json.self_reported_confidence }}"
},
{
"fieldId": "validated_confidence",
"fieldValue": "={{ $json.validated_confidence }}"
},
{
"fieldId": "confidence_adjustment_reason",
"fieldValue": "={{ $json.confidence_adjustment_reason }}"
},
{
"fieldId": "workflow_id",
"fieldValue": "={{ $json.workflow_id }}"
},
{
"fieldId": "workflow_name",
"fieldValue": "={{ $json.workflow_name }}"
},
{
"fieldId": "error_message",
"fieldValue": "={{ $json.error_message }}"
}
]
}
},
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 1,
"continueOnFail": true,
"waitBetweenTries": 5000
},
{
"id": "b63f5bcd-e620-4041-ba80-9c1204b0ac42",
"name": "Error Trigger",
"type": "n8n-nodes-base.errorTrigger",
"position": [
-192,
160
],
"parameters": {},
"typeVersion": 1
},
{
"id": "020dc12a-3e9c-478a-a6a4-ac885ccdb1e9",
"name": "HTTP Request - Get workflow JSON",
"type": "n8n-nodes-base.httpRequest",
"maxTries": 3,
"position": [
656,
160
],
"parameters": {
"url": "={{ $('Config - context').first().json.n8n_base_url + '/api/v1/workflows/' + $('Code - Build context').first().json.workflow_id }}",
"options": {},
"authentication": "predefinedCredentialType",
"nodeCredentialType": "n8nApi"
},
"credentials": {
"n8nApi": {
"name": "<your credential>"
},
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 4.2,
"continueOnFail": true,
"waitBetweenTries": 5000
},
{
"id": "68ed99a5-a63c-4ae8-ab7c-61ec4e8bd95f",
"name": "Code - Build context",
"type": "n8n-nodes-base.code",
"position": [
480,
160
],
"parameters": {
"jsCode": "const errorData = $('Error Trigger').first().json;\nconst configData = $('Config - context').first().json;\nconst error = errorData?.execution?.error || {};\nconst execution = errorData?.execution || {};\nconst workflow = errorData?.workflow || {};\n\n// Collect all workflow_ fields and merge into one array\nconst allWorkflows = [];\nfor (const key of Object.keys(configData)) {\n if (key.startsWith('workflow_')) {\n try {\n const parsed = JSON.parse(configData[key]);\n if (Array.isArray(parsed)) {\n allWorkflows.push(...parsed);\n }\n } catch (e) {}\n }\n}\n\nconst workflowId = String(workflow.id || '');\nconst match = allWorkflows.find(w => String(w.workflow_id) === workflowId) || {};\n\nconst business_context = {\n business_action: match.business_action || '',\n success_looks_like: match.success_looks_like || '',\n known_failure_modes: match.known_failure_modes || '',\n run_frequency: match.run_frequency || '',\n external_dependencies: match.external_dependencies || ''\n};\n\nreturn [{\n json: {\n error_message: error.message || '',\n error_name: error.name || '',\n error_description: error.description || '',\n error_stack: error.stack || '',\n error_messages: Array.isArray(error.messages) ? error.messages : [],\n error_context: (error.context && typeof error.context === 'object') ? error.context : {},\n error_node: (error.node && typeof error.node === 'object') ? error.node : {},\n last_node_executed: execution.lastNodeExecuted || '',\n execution_id: execution.id || '',\n execution_mode: execution.mode || '',\n execution_url: execution.url || '',\n workflow_id: workflowId,\n workflow_name: workflow.name || '',\n business_context,\n technical_email: configData.technical_email || '',\n from_email: configData.from_email || ''\n }\n}];"
},
"typeVersion": 2
},
{
"id": "86910223-481c-40d6-83d1-887a02b858e1",
"name": "New error notification",
"type": "n8n-nodes-resend.resend",
"position": [
256,
160
],
"parameters": {
"to": "={{ $json.technical_email }}",
"from": "={{ $json.from_email }}",
"html": "=<p>Error detected in the workflow <strong>{{ $('Error Trigger').item.json.workflow.name }}</strong>.</p>\n\n<p><strong>Failing node</strong><br>\n{{ $('Error Trigger').item.json.execution.error.node.name }}</p>\n\n<p><strong>Last successful node</strong><br>\n{{ $('Error Trigger').item.json.execution.lastNodeExecuted }}</p>\n\n<p><strong>Error</strong><br>\n{{ $('Error Trigger').item.json.execution.error.message }}</p>\n\n<p>The diagnosis system has been notified and is now analyzing the issue. You will receive a follow-up email with the root cause, a fix, and recommendations to prevent this from happening again.</p>\n\n<p>No action required on your end.</p>",
"subject": "=New error detected in n8n workflow: {{ $('Error Trigger').item.json.workflow.name }}",
"additionalOptions": {}
},
"credentials": {
"resendApi": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 1,
"waitBetweenTries": 5000
},
{
"id": "cab5e67e-6235-4719-a6dd-84a27028dde9",
"name": "Full diagnosis email",
"type": "n8n-nodes-resend.resend",
"position": [
3408,
80
],
"parameters": {
"to": "={{ $('Code - Build context').item.json.technical_email }}",
"from": "={{ $('Code - Build context').item.json.from_email }}",
"html": "=<p>Something went wrong in your workflow: <strong>{{ $('Code - Merge output').first().json.workflow_name }}</strong></p>\n\n<p><strong>What went wrong</strong><br>\n{{ $('Code - Merge output').first().json.direct_cause }}</p>\n\n<p><strong>How to fix it</strong><br>\n{{ $('Code - Merge output').first().json.fix }}</p>\n\n<p><strong>How to prevent it</strong><br>\n{{ $('Code - Merge output').first().json.prevention }}</p>\n\n<p>Diagnosis confidence: {{ $('Code - Merge output').first().json.validated_confidence }}%</p>\n\n<p><strong>More information about the analysis</strong><br>\nThe full diagnosis has been saved to your Supabase error log table.</p>",
"subject": "=The error in the workflow has been analysed: {{ $('Code - Merge output').first().json.workflow_name }}",
"additionalOptions": {}
},
"credentials": {
"resendApi": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 1,
"waitBetweenTries": 5000
},
{
"id": "71cac291-b3fc-4b97-95de-265a73f421db",
"name": "Diagnosis with reservation email",
"type": "n8n-nodes-resend.resend",
"position": [
3680,
144
],
"parameters": {
"to": "={{ $('Code - Build context').item.json.technical_email }}",
"from": "={{ $('Code - Build context').item.json.from_email }}",
"html": "=<p>Something went wrong in the workflow: <strong>{{ $('Code - Merge output').first().json.workflow_name }}</strong></p>\n\n<p><strong>Note:</strong> The confidence in this diagnosis is {{ $('Code - Merge output').first().json.validated_confidence }}%. Please verify before applying the fix.</p>\n\n<p><strong>What went wrong</strong><br>\n{{ $('Code - Merge output').first().json.direct_cause }}</p>\n\n<p><strong>How to fix it</strong><br>\n{{ $('Code - Merge output').first().json.fix }}</p>\n\n<p><strong>How to prevent it</strong><br>\n{{ $('Code - Merge output').first().json.prevention }}</p>\n\n<p>Diagnosis confidence: {{ $('Code - Merge output').first().json.validated_confidence }}%</p>\n\n<p><strong>More information about the analysis</strong><br>\nThe full diagnosis has been saved to your Supabase error log table.</p>\n\n\n",
"subject": "=The error in the workflow has been analysed: {{ $('Code - Merge output').first().json.workflow_name }}",
"additionalOptions": {}
},
"credentials": {
"resendApi": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 1,
"waitBetweenTries": 5000
},
{
"id": "e8533e30-78a2-40c7-9e3b-fed34a635eb8",
"name": "Error notification low confidence",
"type": "n8n-nodes-resend.resend",
"position": [
3680,
336
],
"parameters": {
"to": "={{ $('Code - Build context').item.json.technical_email }}",
"from": "={{ $('Code - Build context').item.json.from_email }}",
"html": "=<p>An error occurred in the workflow <strong>{{ $('Code - Merge output').first().json.workflow_name }}</strong>.</p>\n\n<p>The system detected the error in your workflow, but the confidence in the automated diagnosis result is low (<50%). This means the available data was not sufficient to produce a reliable diagnosis.</p>\n\n<p>In many cases, this is caused by a data mapping issue within the workflow. For privacy and data security reasons, data processed by the workflow is not used or accessed during the diagnosis, which means this type of issue needs manual review.</p>\n\n<p>Please check your workflow manually and verify what went wrong before applying any fix.</p>\n\n<p><strong>More information about the analysis</strong><br>\nThe full diagnosis has been saved to your Supabase error log table.</p>",
"subject": "=The error in the workflow has been analysed: {{ $('Code - Merge output').first().json.workflow_name }}",
"additionalOptions": {}
},
"credentials": {
"resendApi": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 1,
"waitBetweenTries": 5000
},
{
"id": "114dae3b-8982-45d3-8f34-2f5cfb471bfa",
"name": "Alert: context missing",
"type": "n8n-nodes-resend.resend",
"position": [
1008,
288
],
"parameters": {
"to": "={{ $('Code - Build context').item.json.technical_email }}",
"from": "={{ $('Code - Build context').item.json.from_email }}",
"html": "=Workflow context missing in error catcher workflow\n\n<p><strong>Workflow ID:</strong> {{ $('Code - Build context').item.json.workflow_id }}</p>\n<p><strong>Workflow name:</strong> {{ $('Code - Build context').item.json.workflow_name }}</p>\n<p><strong>Reason:</strong> One or more required inputs are missing. Please check the Config node or the HTTP node - get workflow JSON.</p>\n<p><strong>Execution URL:</strong> <a href=\"{{ $('Error Trigger').item.json.execution.url }}\">{{ $('Error Trigger').item.json.execution.url }}</a></p>",
"subject": "=Alert: Missing business context for {{ $('Code - Build context').item.json.workflow_name }}",
"additionalOptions": {}
},
"credentials": {
"resendApi": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 1,
"waitBetweenTries": 5000
},
{
"id": "d9393993-5515-4cf2-bf71-17d79b485410",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-256,
-48
],
"parameters": {
"color": "#E9BABA",
"width": 224,
"height": 576,
"content": " ## Catch the error\n\nAutomatically activated as soon as one of your other workflows encounters an error.\n"
},
"typeVersion": 1
},
{
"id": "2f776ebe-fff0-44df-af52-fd57ee1474bf",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-32,
-48
],
"parameters": {
"color": 7,
"width": 224,
"height": 576,
"content": " ## Configuration\nThe only node you need to fill in yourself. Enter your email address, sending address, n8n URL and the business context of your workflows here. "
},
"typeVersion": 1
},
{
"id": "76575a1c-7155-4fc5-b8b9-1110a3f65477",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
192,
-48
],
"parameters": {
"color": 2,
"width": 224,
"height": 576,
"content": " ## First notification\n\nYou immediately receive a first notification by email so you know something went wrong."
},
"typeVersion": 1
},
{
"id": "eb31f9f1-295f-43ae-90a8-890427532607",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
416,
-48
],
"parameters": {
"color": 4,
"width": 720,
"height": 576,
"content": " ## Retrieve workflow context\n\nRetrieves the technical details of the failed workflow via the n8n API. It then checks whether business context is available in the Config node. If this context is missing, you receive a separate notification so you can check the Config node."
},
"typeVersion": 1
},
{
"id": "198e3a66-444a-4d9e-94cb-e4b813fce36c",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1136,
-48
],
"parameters": {
"color": 5,
"width": 480,
"height": 576,
"content": " ## Retrieve historical context\n\nRetrieves the last three diagnoses of the same workflow from the database. This allows the AI to recognize whether an error has occurred before and take this into account in the diagnosis."
},
"typeVersion": 1
},
{
"id": "a2ff2281-3502-4c44-a5c2-3a29c4d8c39b",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1616,
-48
],
"parameters": {
"color": 6,
"width": 480,
"height": 576,
"content": " ## AI diagnosis\n\nClaude AI analyzes the error based on all available context. The diagnosis contains the direct cause, the underlying cause, an analysis of the timing and a step-by-step fix. A Haiku fallback model ensures continuity if the primary model is unavailable."
},
"typeVersion": 1
},
{
"id": "35b3ed86-3369-4de1-9b3b-286911b66e27",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
2096,
-48
],
"parameters": {
"color": "#F7DEEB",
"width": 496,
"height": 576,
"content": " ## Quality control\n\nA second AI agent independently evaluates the diagnosis from step 5 on four criteria and validates or corrects the confidence score. This ensures you only receive a full diagnosis when the AI is sufficiently confident.\n\n"
},
"typeVersion": 1
},
{
"id": "fc59dacd-b326-4692-ac99-89877fc17d3f",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
2592,
-48
],
"parameters": {
"color": "#ECC674",
"width": 480,
"height": 576,
"content": " ## Save diagnosis\nThe diagnosis is merged and saved in your Supabase database. This gives you a complete overview of all errors and diagnoses at all times, even if you missed an email.\n"
},
"typeVersion": 1
},
{
"id": "6133a3c7-01a6-477b-9792-0ae3a78a5557",
"name": "Sticky Note8",
"type": "n8n-nodes-base.stickyNote",
"position": [
3072,
-48
],
"parameters": {
"color": "#C7DCD6",
"width": 864,
"height": 576,
"content": " ## Send email\n\nBased on the confidence score you receive one of three emails. At 80% or above you receive the full diagnosis. Between 50 and 79% you receive the diagnosis with a reservation. Below 50% you only receive a notification that the error could not be diagnosed with sufficient confidence.\n"
},
"typeVersion": 1
},
{
"id": "944dc3e3-fb8e-4db0-857f-4d30f204fbb5",
"name": "Config - context",
"type": "n8n-nodes-base.set",
"position": [
32,
160
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "fa1+1234567890-+1234567890",
"name": "technical_email",
"type": "string",
"value": "[user@example.com]"
},
{
"id": "9ce0b0b4-282e-4ef4-84f8-8fe8330ddc8e",
"name": "from_email",
"type": "string",
"value": "[user@example.com]"
},
{
"id": "fa1+1234567890-+1234567890",
"name": "n8n_base_url",
"type": "string",
"value": "[https://your-n8n-instance.com]"
},
{
"id": "fa1+1234567890-+1234567890",
"name": "workflow_1",
"type": "string",
"value": "[{\"workflow_id\": \"your-workflow-id-here\", \"business_action\": \"Describe what this workflow does\", \"success_looks_like\": \"Describe the expected result when everything works\", \"known_failure_modes\": \"Describe errors that occur more often\", \"run_frequency\": \"e.g. every hour / daily / on trigger\", \"external_dependencies\": \"e.g. Gmail, HubSpot, Airtable\"}]"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "b899a5dd-8339-499a-9240-6fe0a08d37d1",
"name": "Sticky Note9",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1072,
-256
],
"parameters": {
"width": 752,
"height": 784,
"content": "## Auto-diagnose n8n workflow errors with Claude AI and send fix by email\n\n### How it works\n\nWhen a workflow fails, this system activates automatically. Claude AI analyzes the error using the technical details and your business context, then sends you an email with the root cause, a step-by-step fix and prevention advice. A second AI agent validates the confidence score to ensure diagnosis quality.\n\n\n### Setup\n\n**Step 1 \u2014 Supabase**\nGo to supabase.com, create a free project and run the SQL from the full installation guide on flowcheckers.com in the SQL Editor to create the error_log table. Copy your Project URL and Service Role Key from Settings \u2192 API.\n\n**Step 2 \u2014 Resend**\nGo to resend.com, verify your domain under Domains \u2192 Add Domain and add the DNS records at your domain registrar. Create an API key under API Keys.\n\n**Step 3 \u2014 Credentials**\nIn n8n go to Settings \u2192 Credentials and create four credentials: Anthropic (type: Anthropic), Supabase (type: Supabase), Resend (type: Resend), n8n API (type: n8n API).\n\n**Step 4 \u2014 Config node**\nOpen the Config node and fill in your email address, sending address, n8n URL and business context for each workflow you want to monitor.\n\n**Step 5 \u2014 Link credentials**\nLink credentials to the correct nodes \u2014 see the section stickies for details.\n\n**Step 6 \u2014 Activate**\nActivate the system via the toggle in the top right. Then open each workflow you want to monitor \u2192 three dots \u2192 Settings \u2192 Error Workflow \u2192 select this auto-diagnose system.\n\n\n### Customization\n\nAdd workflow_2, workflow_3 etc. in the Config node for additional workflows. Adjust the Resend email nodes to match your own tone or branding\n\n\n**Need the full installation guide including SQL code? Download it free at flowcheckers.com**"
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"binaryMode": "separate",
"executionOrder": "v1"
},
"versionId": "8bb9afd2-2c18-400f-a1ae-72573fe54644",
"connections": {
"If": {
"main": [
[
{
"node": "Supabase - Get historical context",
"type": "main",
"index": 0
}
],
[
{
"node": "Alert: context missing",
"type": "main",
"index": 0
}
]
]
},
"Error Trigger": {
"main": [
[
{
"node": "Config - context",
"type": "main",
"index": 0
}
]
]
},
"Sonnet 4.6 - 1": {
"ai_languageModel": [
[
{
"node": "Claude Diagnosis",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Sonnet 4.6 - 2": {
"ai_languageModel": [
[
{
"node": "Claude Scoring Judge",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Claude Diagnosis": {
"main": [
[
{
"node": "Claude Scoring Judge",
"type": "main",
"index": 0
}
]
]
},
"Config - context": {
"main": [
[
{
"node": "New error notification",
"type": "main",
"index": 0
}
]
]
},
"Code - Merge output": {
"main": [
[
{
"node": "Supabase - Save diagnosis",
"type": "main",
"index": 0
}
]
]
},
"Claude Scoring Judge": {
"main": [
[
{
"node": "Code - Merge output",
"type": "main",
"index": 0
}
]
]
},
"Code - Build context": {
"main": [
[
{
"node": "HTTP Request - Get workflow JSON",
"type": "main",
"index": 0
}
]
]
},
"Haiku 4.5 fallback 1": {
"ai_languageModel": [
[
{
"node": "Claude Diagnosis",
"type": "ai_languageModel",
"index": 1
}
]
]
},
"Haiku 4.5 fallback 2": {
"ai_languageModel": [
[
{
"node": "Claude Scoring Judge",
"type": "ai_languageModel",
"index": 1
}
]
]
},
"Code - Prepare context": {
"main": [
[
{
"node": "Claude Diagnosis",
"type": "main",
"index": 0
}
]
]
},
"New error notification": {
"main": [
[
{
"node": "Code - Build context",
"type": "main",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "Claude Diagnosis",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"IF \u2014 Confidence \u2265 50?": {
"main": [
[
{
"node": "Diagnosis with reservation email",
"type": "main",
"index": 0
}
],
[
{
"node": "Error notification low confidence",
"type": "main",
"index": 0
}
]
]
},
"IF \u2014 Confidence \u2265 80?": {
"main": [
[
{
"node": "Full diagnosis email",
"type": "main",
"index": 0
}
],
[
{
"node": "IF \u2014 Confidence \u2265 50?",
"type": "main",
"index": 0
}
]
]
},
"Supabase - Save diagnosis": {
"main": [
[
{
"node": "IF \u2014 Confidence \u2265 80?",
"type": "main",
"index": 0
}
]
]
},
"Structured Output Parser 2": {
"ai_outputParser": [
[
{
"node": "Claude Scoring Judge",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"HTTP Request - Get workflow JSON": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Supabase - Get historical context": {
"main": [
[
{
"node": "Code - Prepare context",
"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.
anthropicApihttpHeaderAuthn8nApiresendApisupabaseApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow is for anyone who runs n8n workflows and wants to know immediately when something breaks, without digging through execution logs. Especially useful for non-technical users and freelancers or agencies managing workflows for clients.
Source: https://n8n.io/workflows/15484/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
⏺ 🚀 How it works
This workflow is designed for marketers, founders, agencies, and product teams who want to understand how real customers talk about a product category, market, or problem space.
This workflow is designed for e-commerce, marketing teams, or creators who want to automate the production of high-quality, AI-generated product visuals and ad creatives.
The Shopify AI Product Description Factory is a production-grade n8n workflow that converts product images and metadata into refined, SEO-aware descriptions—fully automated and region-agnostic. It ble
This workflow streamlines academic paper development through a multi-agent AI architecture that collects references, drafts individual sections autonomously, compiles the manuscript, and exports a pro