Debug n8n webhook failures in VS Code
An n8n webhook can return 200 OK as soon as it receives a request. This sandbox reproduces a failure after that response. You’ll use the n8n error report to find the failed step in VS Code and test how a local receiver handles the report.
Try the n8n demo without an account
Install Hookmetry, leave --demo enabled, and paste this prompt into GitHub Copilot Chat in Agent mode.
Use Hookmetry's diagnose_failure tool with ID demo-n8n. Explain why this report has no execution ID and include the Hookmetry source link.Expand the tool call to see a synthetic trigger-level failure with a missing execution ID.
Download the sandbox workflows
Save both files and import them into n8n. In Report failure, replace the loopback URL with your persistent Hookmetry test endpoint. Select the imported error reporter in the order workflow’s settings and publish both workflows.
Reproduce the failure manually
Use a sandbox n8n instance and a persistent Hookmetry test endpoint. Reading recorded failures requires a Hookmetry account. Keep the capture URL and read-only MCP credential private.
- Create an error workflow with an Error Trigger and an HTTP Request node. POST to the Hookmetry capture URL with the header
X-Hookmetry-Source: n8n. Enable Send Body, select JSON, and use the expression below. Publish the error workflow. - In a second workflow, connect a Webhook trigger to Stop And Error. Configure the webhook to accept POST and respond Immediately. Set the error message to
Hookmetry sandbox failure. Select the error workflow in Settings and enable saving failed production executions. - Publish the main workflow and send a POST to its Production URL. In n8n, open Executions and note the workflow ID, execution ID, and last node.
{{ ({
type: 'n8n.execution.failed',
workflow: { id: $json.workflow.id },
execution: {
id: $json.execution?.id,
lastNodeExecuted: $json.execution?.lastNodeExecuted
},
error: {
name: $json.execution?.error?.name ?? $json.trigger?.error?.name,
message: $json.execution?.error?.message ?? 'Workflow failed'
}
}) }}The sandbox forwards the error message. Use a fixed label or redact the message when adapting the example to a workflow whose errors can contain credentials or customer data.
Send the test POST
Replace the example URL with the main workflow’s Production URL.
Bash or Zsh
curl -X POST 'https://YOUR_N8N_HOST/webhook/YOUR_PATH' \
-H 'Content-Type: application/json' \
-d '{"orderId":101}'PowerShell
Invoke-RestMethod -Method Post -Uri 'https://YOUR_N8N_HOST/webhook/YOUR_PATH' `
-ContentType 'application/json' -Body '{"orderId":101}'Inspect the failure and save a regression test
- Open the capture in Hookmetry. Use MCP access on the test endpoint to issue a read-only credential. Store it as
HOOKMETRY_MCP_TOKENin your editor’s user configuration, remove--demo, and restart the MCP server. - Ask Copilot to use Hookmetry to list the latest failure, diagnose it, and cite the recorded workflow ID, execution ID, and last node. Compare the tool result with n8n. Trigger-level failures can arrive without an execution ID. For a failure after the trigger, check that n8n saves failed production executions.
- Open the capture link and find
Hookmetry sandbox failurein the n8n execution panel. Choose Save as test, review the JSON fixture, set the expected status for your local error-report receiver, and downloadwebhook-regression.test.cjs. - Point the test at your local receiver and run it with Node’s test runner. It sends the error report fixture and checks the receiver’s response. Run the upstream workflow in n8n to reproduce the execution itself.
Bash or Zsh
HOOKMETRY_TEST_URL='http://127.0.0.1:3000/n8n-reports' node --test ./webhook-regression.test.cjsPowerShell
$env:HOOKMETRY_TEST_URL = 'http://127.0.0.1:3000/n8n-reports'
node --test .\webhook-regression.test.cjsThis sandbox was verified locally on n8n 2.50.6. n8n acknowledged the test POST, sent the error report, and the regression test generated from that report passed against a local receiver.