Limit n8n AI workflow alerts to three fields A developer published a technique for limiting n8n AI workflow failure alerts to three fields—workflow label, failure phase, and execution ID—so that request and response details in error payloads don't leak into Slack or email. The approach uses an Error Trigger feeding a Code node that maps workflow IDs to approved labels and validates the execution ID before building the outgoing message, with a staging Webhook → Stop And Error workflow to test delivery. The JavaScript was checked with synthetic inputs, but delivery through a live n8n workflow remains untested. An AI workflow failure can leave request or response details in its error payload. For an alert sent to Slack or email, a workflow label, a failure phase, and an execution ID are enough to start the investigation. Save an error workflow with Error Trigger → Code → Slack or Email . In the AI workflow’s settings, select it under Error workflow . You can assign one error workflow to multiple workflows. n8n error workflow setup https://docs.n8n.io/build/flow-logic/handle-errors-gracefully.md Set the Code node to JavaScript and Run Once for All Items . Replace the synthetic workflow ID 42 and label support-triage with values you’ve approved for the alert destination. n8n Code node https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.code js const event = $input.first .json; const workflowLabels = new Map "42", "support-triage" ; const workflow = workflowLabels.get String event.workflow?.id ?? "" ?? "unmapped"; const phase = event.trigger ? "trigger" : event.execution ? "execution" : "unknown"; const alert = { workflow, phase }; const rawId = event.execution?.id; const id = typeof rawId === "string" ? rawId : Number.isSafeInteger rawId ? String rawId : ""; if /^ 0-9 {1,20}$/.test id { alert.executionId = id; } return { json: alert } ; Build the outgoing message using only workflow , phase , and executionId when present. A saved failure could produce support-triage · execution · 231 . A failure in the trigger could produce support-triage · trigger . An unsaved execution can also lack an ID, so use the event’s trigger and execution fields to distinguish the two. n8n Error Trigger payload https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.errortrigger error-data In staging, use an authenticated Webhook → Stop And Error workflow with the synthetic message ALERT TEST ONLY . Assign the error workflow and set the alert destination to a test channel. Publish the staging workflow, call the webhook’s Production URL once, then unpublish it. Error Trigger runs on automatic failures, so Execute workflow in the editor won’t exercise it. Webhook URL behavior https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.webhook webhook-urls Verify that the alert arrives with the expected label and phase. Check that the error message, stack, and execution URL are absent. Review who can access execution data and how long it’s retained separately from the alert. The JavaScript was checked with synthetic inputs. Delivery through a live n8n workflow is untested.