Skip to main content

Error Workflows

An error workflow runs automatically when a run of another workflow fails, so that failures nobody is watching (schedules, Kafka messages, emails, background sub-workflows) still reach someone: post to a chat channel, open a ticket, send an email, or retry.

Set it up​

  1. Create the error workflow as a standalone workflow. It must start with a Called by Workflow trigger (an input_schema is optional) or a Manual trigger, and it must be published.
  2. Open the workflow to watch, then ⋯ › Settings › Error workflow, choose the error workflow and click Save settings. The list offers the other workflows that start with Called by Workflow or Manual; None turns error handling off. If the server refuses the choice, the dialog shows its reason. Through the API, set error_workflow_id to the error workflow's id:
PUT /api/v1/workflows/{id}
{ "settings": { "error_workflow_id": "<error workflow id>" } }

Send the other settings (timeout_ms, save_run_data) along with it: settings is saved as a whole. Several workflows can share one error workflow. Settings live in the workflows store, so a proxy's inline workflow that is not in the store yet has no error workflow.

The save is refused (400) when the error workflow does not exist in the workflows store, is the workflow itself, or does not start with a Called by Workflow or Manual trigger (checked on its published version, else its draft). The check runs when error_workflow_id changes.

When it runs​

The error workflow runs when a run of the watched workflow fails (status failed) and that run is recorded in run history: schedules, Kafka messages, emails, manual runs, sub-workflows, guardrails, and API requests through a proxy whose workflow fails.

  • Handled errors are not failures: a step that takes its error branch and the workflow ends normally does not start the error workflow.
  • Console test runs and draft runs never start it.
  • It runs in the background: the failed run (and the API caller, for a proxy's workflow) never waits for it and is never affected by it.
  • It runs the error workflow's published version, as a production run, bounded by the error workflow's own timeout (settings.timeout_ms, 60 seconds by default, at most 10 minutes). It does not need to be active.
  • An error workflow that fails, and anything it calls, never starts error handling again, so two workflows that name each other cannot loop.
  • Each server runs at most 2 error workflows at a time and keeps up to 64 waiting. When the queue is full, the failure is dropped (logged and counted). The metric zerq_workflow_error_handler_runs_total{result} counts succeeded, failed, skipped (the error workflow is missing, unpublished or has no suitable trigger) and dropped.

Input​

The error workflow's trigger receives this input ({{ $json['<trigger id>'].input.error }} and so on):

{
"workflow_id": "6650…",
"workflow_name": "Nightly report",
"run_id": "3f1c…",
"version": 4,
"mode": "background",
"trigger": { "type": "cron_trigger", "node_id": "cron_1" },
"error": "node send_report (http_request_node): upstream answered 502",
"failed_node": { "id": "send_report", "type": "http_request_node", "error": "upstream answered 502" },
"started_at": "2026-11-08T02:00:00Z"
}
FieldDescription
workflow_id, workflow_nameThe workflow whose run failed
run_idThe failed run: open it in Executions
versionThe published version that ran (0 for a proxy's inline workflow)
modeHow it ran: gateway, background, manual, sub or guardrail
trigger{type, node_id}, plus proxy_id for proxy runs and parent_run_id for sub-workflows
errorThe run's error (at most 2 KB)
failed_nodeThe last step that failed, or null when no step failed (for example a run timeout)
started_atWhen the failed run started (RFC 3339)

With a Called by Workflow trigger and an input_schema, an input that does not match skips the run (logged, counted as skipped).

In run history​

Error workflow runs are recorded with mode error_handler and trigger.parent_run_id set to the failed run. In Executions they show Started by: Error workflow (a choice in the Started by filter), and the run view links to the Failed run. Through the API, filter them with GET /api/v1/workflows/runs?mode=error_handler.

Example​

A workflow "Alert on failure" (workflow_trigger_1 → http_request_node posting to a chat webhook):

{
"id": "notify",
"type": "http_request_node",
"data": {
"inputs": {
"url": "https://hooks.example.com/alerts",
"method": "POST",
"body": {
"type": "json",
"content": {
"text": "Workflow {{ $json['workflow_trigger_1'].input.workflow_name }} failed: {{ $json['workflow_trigger_1'].input.error }} (run {{ $json['workflow_trigger_1'].input.run_id }})"
}
}
}
}
}