An error workflow is a dedicated workflow that runs automatically when another workflow fails, receiving details about the failure and carrying out a defined response such as alerting an operator, logging the incident, compensating partial work or scheduling a retry. In automation, it is a core reliability mechanism: instead of letting a failed run stop silently, the platform routes the failure into a predictable handling path that people can monitor, test and improve.
Most workflow engines and integration platforms support the idea under different names, including error handler, failure workflow, catch flow or on-failure hook. The common principle is a separation of concerns: the main workflow describes the business process, while the error workflow describes what happens when that process cannot finish.
How an error workflow is triggered
An error workflow starts when the engine detects an unhandled failure in a monitored workflow and passes an error payload to the handler. The payload usually includes the workflow identifier, the execution ID, the failing step, the error message, a timestamp and sometimes a snapshot of input data, which gives the handler enough context to act without querying the original run.
Engines differ in where the trigger is attached. Some platforms let each workflow name one error workflow in its settings, others use try-catch blocks around individual steps, and orchestration systems often provide both: a step-level catch for expected faults and a workflow-level handler for everything that escapes.
The table below summarizes the most common trigger scopes and what each one is suited to handle.
| Scope | When it fires | Typical use |
|---|---|---|
| Step-level catch | A single node or activity throws | Fallback value, alternate API, local retry |
| Branch or block handler | Any step inside a grouped section fails | Rollback of a sub-process |
| Workflow-level error workflow | The whole run ends in a failed state | Alerting, ticketing, compensation |
| Global or platform handler | Any workflow in a workspace fails | Central incident logging and dashboards |
| Timeout handler | A run exceeds its maximum duration | Cancellation and stale job cleanup |
Typical steps inside an error workflow
A well-designed error workflow follows a classify, record, notify, recover sequence. It first decides what kind of failure occurred, then stores the evidence, informs the right people and finally takes a recovery action that matches the error class.
- Classify the error as transient, permanent, data-related or unknown, based on status codes and messages.
- Record the incident with the execution ID, payload reference and correlation ID for later analysis.
- Notify the owner through chat, email, paging or a ticket, with severity matched to business impact.
- Recover or contain by retrying, compensating, moving the item to a dead letter queue or pausing the source.
- Close the loop by marking the incident resolved or escalating it when recovery fails.
Classification matters because the correct response depends on the cause. The following table maps frequent error classes to a sensible default action.
| Error class | Example | Default response |
|---|---|---|
| Transient | HTTP 503, network timeout, rate limit 429 | Retry with exponential backoff |
| Permanent | HTTP 400, invalid credentials, missing record | Alert and stop without retry |
| Data quality | Schema mismatch, null required field | Quarantine item, notify data owner |
| Partial completion | Payment captured but order not saved | Run compensating action |
| Unknown | Unexpected exception text | Alert with full context for triage |
Error workflow and related reliability patterns
An error workflow is the coordinating layer that often invokes other reliability mechanisms rather than replacing them. A retry policy decides whether to try again, a dead letter queue stores messages that cannot be processed, and the saga pattern defines compensating actions, while the error workflow decides which of these applies and records the outcome.
The comparison below clarifies how the error workflow differs from neighboring concepts in the same reliability toolkit.
| Concept | Primary role | Relationship to the error workflow |
|---|---|---|
| Retry policy | Repeats a failed step automatically | Runs first; the handler acts when retries are exhausted |
| Dead letter queue | Holds unprocessable messages | A common destination chosen by the handler |
| Compensating action | Undoes completed side effects | Triggered by the handler after partial success |
| Workflow monitoring | Observes runs and metrics | Receives incidents the handler records |
| Graceful degradation | Keeps a reduced service running | An alternative path the handler may select |
A frequent design question is whether to handle an error inline or in a separate workflow. Inline handling keeps logic close to the failing step, whereas a shared error workflow centralizes alerting conventions and avoids duplicating notification code across dozens of automations.
Designing a dependable error workflow
The handler itself must be more reliable than the workflows it protects, because a broken error workflow hides every other failure. Practitioners keep it short, avoid dependencies on the same external systems that commonly fail, and give it a minimal fallback such as writing to a local log when the alerting channel is unavailable.
- Make actions idempotent so that a handler triggered twice for the same execution does not open duplicate tickets or refund twice.
- Pass references, not raw data, when payloads contain personal or financial information, and mask secrets before logging.
- Deduplicate alerts by grouping repeated failures from one workflow within a time window to prevent alert fatigue.
- Include a replay link or execution ID so the operator can inspect and rerun the failed run after fixing the cause.
- Test the handler deliberately by forcing failures in a staging environment, since rarely used code paths decay unnoticed.
Severity routing is a practical decision that teams often formalize. The decision table below shows a common mapping between business impact and notification behavior.
| Situation | Recommended handling | Reason |
|---|---|---|
| Customer-facing transaction fails | Page on-call engineer immediately | Direct revenue or trust impact |
| Nightly report job fails | Ticket plus morning chat message | Delay is tolerable for hours |
| Single record rejected in a batch | Quarantine and daily digest | Rest of the batch remains valid |
| Same error repeats every minute | Pause the trigger and alert once | Prevents floods and runaway costs |
Common mistakes and failure modes
The most damaging mistake is swallowing errors silently, for example by catching an exception and continuing with an empty value, so the run appears successful while data is lost. A related problem is retrying permanent errors, which wastes quota, can trigger account lockouts and delays the alert that a person actually needs.
Other failure modes include recursive error loops, where the error workflow fails and triggers itself, and missing context, where an alert says only that something failed without naming the run or step. Most engines prevent self-triggering, but teams should verify this behavior and set a separate fallback for the handler rather than assuming it.
| Symptom | Likely cause | Fix |
|---|---|---|
| Runs show success but data is missing | Errors caught and ignored | Rethrow or route to the handler |
| Hundreds of identical alerts | No deduplication or pause | Group alerts and add a circuit breaker |
| Duplicate refunds after a failure | Non-idempotent recovery step | Use idempotency keys |
| Alerts lack actionable detail | Payload not forwarded | Include execution ID and failing step |
In everyday language
An error workflow is the backup plan an automation follows when something goes wrong. Imagine an automatic coffee machine that, instead of quietly stopping when the water runs out, sends a message to the office manager, notes what happened and switches to a second tank.
Without such a plan, a broken automation can fail for days before anyone notices. With it, failures become visible, recorded and often fixed automatically, so people only step in when their judgment is really needed.
Seen in the real world
An online retailer runs an automation that takes each paid order, creates a shipment with a logistics provider and sends a tracking email. One afternoon the logistics API starts returning HTTP 503 responses. The step-level retry policy tries three times with exponential backoff, and when those attempts fail the run ends and the error workflow takes over.
The handler classifies the failure as transient, places the order in a holding queue, opens a single ticket for the integration team and posts one grouped chat alert instead of 140 separate messages. When the provider recovers forty minutes later, an operator replays the queued orders. Every order ships the same day, no customer receives a duplicate email, and the incident record shows exactly which runs were affected.