broccolli.xyz
Blog

Process Automation | Tools

What Happens When an Automation Fails? Exceptions, Retries and Fallbacks

· 7 min

An automation that works 99 times out of 100 looks reliable. The trouble is the hundredth run. If nobody has decided how automation error handling should work, the answer tends to be the worst one: the invoice never reaches the ERP, the customer never gets a confirmation, and nobody notices until someone phones to complain.

This article covers the three mechanisms that separate a fragile automation from one that survives production: exception handling, retries and fallbacks. More importantly, it covers when each of them does more harm than good.

Failing is not the problem. Failing silently is

Every automation that talks to other systems will fail. An API goes down for a few minutes. A token expires. A supplier sends a PDF in a new layout. A customer record turns up without a VAT number.

None of this means the flow was badly built. It is simply the environment a flow lives in.

What sets a well-built flow apart is that three questions were answered before go-live:

  • Which failures fix themselves if you just try again?
  • Which failures need a person, and which person?
  • What happens to work that was left half done?

When those questions have no answer, the dashboard stays green. The errors pile up out of sight.

Three kinds of failure, three different responses

The most common mistake in error handling is treating every failure the same way. It helps to split them into three families.

Transient failures

The system on the other side is briefly unavailable, slow or rate-limiting you. Typically: timeouts, 503 (service unavailable) or 429 (too many requests). In a few seconds or minutes, the same request will probably go through.

Right response: try again, waiting a little longer each time.

Permanent failures

The request is wrong and will stay wrong however many times you send it. Invalid credentials (401), malformed data (400), a missing mandatory field, a record that does not exist.

Right response: do not retry. Stop that item, log the reason and route it to whoever can fix it.

Business exceptions

Technically everything works, but the case does not fit the rule. An invoice above the approval limit. A supplier who is not in the database. A discount nobody signed off.

Right response: leave the automated path for a human review queue, with full context. This is not a malfunction. It is the automation doing exactly what it should.

Retries: useful, but with rules

A retry is the simplest form of resilience: if it failed, try again. Automation platforms ship with it built in.

In n8n, every node has a Retry On Fail setting with a maximum number of tries and a wait between them. In Power Automate, Microsoft's error handling guidance describes fixed and exponential retry policies and recommends exponential: for example, the first retry after one minute, the second after two, the third after four. By default, an action's retry policy retries four times.

Three rules separate helpful retries from dangerous ones.

1. Only retry what is safe to retry. Reading data is safe. Creating an invoice is not, unless the flow is idempotent: processing the same request twice must give the same result as processing it once. If the ERP received the invoice but the response got lost on the way back, a naive retry creates a duplicate.

Amazon's article on timeouts, retries and backoff is blunt about it: APIs with side effects are not safe to retry unless they provide idempotency. In practice that means unique identifiers and upserts, as we explained in the article on integrating CRM, email and invoicing data without duplicates.

2. Wait longer each time, and not all at once. If a service is overloaded, hammering it with immediate retries makes things worse. The wait should grow with each attempt (exponential backoff) and include some randomness (jitter), so that dozens of failed runs do not all come back in the same second.

3. Retry in one place only. This is the least intuitive rule. In the same article, Amazon describes a five-layer stack where each layer tries three times: the load on the database at the bottom grows 243-fold (3 to the power of 5). In SME automation, the usual version is a retry on the HTTP node, another on the sub-workflow and a schedule that reruns the whole flow. Pick one level and switch the others off.

Fallbacks: plan B has to be designed

Once retries run out, the automation needs to know where to go. That is a fallback: an alternative path defined in advance, not improvised on the day things break.

Useful fallbacks in an SME are rarely sophisticated. The common ones:

  • Exception queue. The item is stored in a table with the error, the input data and a timestamp. Someone deals with it later, but it is not lost.
  • Degraded mode. If the ERP does not respond, the invoice is recorded in an intermediate system and synced later. The process slows down but does not stop.
  • Secondary channel. If the SMS service fails, the notification goes out by email.
  • Hand-off to a person. For business exceptions, the fallback is human: an assigned task with enough context to decide in two minutes.

In n8n, you build this with On Error → Continue (using error output), which adds a separate output for failed items, or with an error workflow. According to n8n's error handling documentation, an error workflow starts with an Error Trigger node, can serve several workflows and receives the workflow name, the error message, the last node executed and a link to the failed execution. In Power Automate, the equivalent is the Try/Catch pattern using scopes and the Run after setting.

A worked example

Take a flow that posts supplier invoices received by email into the ERP. The figures below are an illustrative estimate, not a measurement.

The company receives 600 invoices a month. Assume 2% of ERP writes fail because of brief outages, and 3% of invoices arrive with data the flow cannot validate (unreadable VAT number, unknown supplier).

Without error handling: around 12 invoices a month fail for transient reasons and 18 because of bad data. That is 30 invoices that never get in, and nobody knows which. They surface at month-end, when the reconciliation does not match. At 15 minutes each to track down and key in by hand, that is 7.5 hours of work, landing in the worst week of the month.

With error handling: the 12 transient failures resolve themselves with three spaced retries, assuming outages last minutes rather than hours. The 18 problem invoices go to an exception queue, each with its reason. Reviewed the same day, they take perhaps 3 minutes each: about an hour a month, spread out and with no surprises.

The failures are the same in both cases. The difference is knowing where they are.

The most expensive failure raises no alert

Everything above reacts to failures the system can see. The costliest case leaves no trace.

A webhook that stops arriving because the supplier changed a setting. A schedule switched off during an update. A mailbox that no longer receives attachments. The flow does not fail. It simply does not run. No error workflow fires, because there is no execution to fail.

The defence here is different: watch for missing activity. An alert such as "if no invoice has come in by 11am on a working day, tell someone" catches what no retry ever will. The same logic applies to webhooks, which do not guarantee every event is delivered and need periodic reconciliation behind them.

Alerts someone actually reads

An alert is only useful if it reaches the right person with enough information to act. Three practical rules:

  • A named recipient. "The IT team" is not a recipient. Decide who gets it, and who covers during holidays.
  • Context in the alert itself. Which flow, which item (invoice number, customer), which error, and a link to the execution. An alert that sends you into three systems to understand it gets ignored by the third time.
  • Group the noise. If the same API fails 40 times in an hour, the person needs one alert, not 40. Too many alerts have the same effect as none.

What to ask before an automation goes live

If you are assessing an automation, built in-house or by a partner, these five questions say a lot about its maturity:

  1. Which errors are retried automatically, how many times and at what interval?
  2. Are write operations idempotent? What prevents a duplicate invoice?
  3. Where do items that fail for good end up, and who handles them?
  4. How would we know if the flow stopped running?
  5. Where is each execution logged, and for how long?

We expand on these criteria in the article on what to demand from an automation partner before automating critical processes.

The question for this week

Pick the most important automation you have running today. If it fails tomorrow at 10am, how long until someone knows? And who is that person?

If the answer is "it depends" or "probably at month-end", the problem is not technical. It is a decision about automation error handling that nobody has made yet.