Failures and Retries
How the workflow engine retries a failed step, how error branches handle failures, and how failures are reported for embedded runs.
When a step in a connected user's workflow fails, the engine can retry the step, run an error branch, or fail the run. This page describes each behavior so you can tell a customer whether a failure was transient or final.
What happens on a failed step
- The step is marked failed. If it has retries left, the engine dispatches it again.
- Each retry increments the attempt count and waits longer than the previous one.
- When retries are exhausted, the failure propagates: parent steps are marked failed and the run ends as
FAILED. - If the step is inside an Error Handler (
on-error) task, that branch runs instead and the workflow continues.
A run has one of these statuses: CREATED, STARTED, COMPLETED, FAILED or STOPPED. A run that is stopped while it waits on an approval ends as CANCELLED.
Retries
Retries are off by default. A step retries only when maxRetries is set on the task, or on the workflow (which applies to every task that does not set its own):
{
"label": "Create contact",
"name": "createContact",
"type": "hubspot/v1/createContact",
"maxRetries": 3
}The delay before each attempt is 2 seconds multiplied by the attempt number: 2 seconds, then 4, then 6. The backoff is fixed. maxRetries is the only retry setting a workflow definition can express, so the delay cannot be tuned per step.
Retry re-runs the step, not the workflow
A retry dispatches that one step again with the same input. Steps that already succeeded do not run again. Retrying a failed write is safe only if the step is idempotent: a retried "create" against a provider that does not deduplicate can produce two records.
Retries suit transient faults: a provider timeout, a 5xx response, or a rate-limit rejection. They do not help with bad input or a revoked credential, which fail the same way on every attempt and only delay the final failure.
Error branches
To handle a failure instead of retrying it, wrap the step in an Error Handler (on-error) task. The error is captured and the error branch runs, so the workflow can notify someone, write a fallback record, or exit cleanly instead of ending as FAILED. The branch is part of the workflow and applies to every connected user who runs it.
What your product can see
Every attempt is recorded. A run's execution history shows each step with its inputs, outputs and error, including the retried attempts. See Workflow Executions.
Failure notifications
A failed run raises the JOB_FAILED notification event. Subscribe to it in Notifications, which documents the available events and delivery types. The event fires for embedded runs as well as automation runs, because a connected user's run is an ordinary job.
The notification has these properties:
- The subscription is instance-wide, per event. It fires for every failed job in the deployment. There is no filter by integration, workflow, or connected user, so you cannot subscribe on behalf of one customer.
- The message identifies the job, not the customer. The notification is rendered from the job's label and id. It does not carry the connected user, the integration, or the error, so mapping an alert back to a customer means looking the execution up.
- It notifies you, not your users. The destination is a channel your team owns. There is no per-customer destination.
Use it as an operational alert for your own team. To show a failure inside your product for the right customer, poll the executions and raise the alert yourself.
Limitations
No replay from your product
The embedded API has no endpoint to re-run a failed execution, so you cannot offer your customers a "retry this run" button. Fire the trigger again, or add retries to the workflow in advance.
Related
How is this guide?
Last updated on