Every automation that talks to other systems will fail sometimes. An API times out, a model returns malformed output, a rate limit is hit, a record is missing a field. Error handling is the deliberate design of what happens next. It is the clearest difference between a demo that works on the day and a system that can run unattended for months, and it is a common gap in low-priced builds.
How it works
Good error handling starts by sorting failures into two kinds. Temporary failures, such as a timeout or a rate limit, are worth retrying. Permanent failures, such as invalid data or a revoked password, will fail again however often they are retried and need a person.
Retries are usually spaced out with exponential backoff: wait one second, then two, then four, with a little randomness so many callers do not retry at once. After a set number of attempts the item is moved aside to a "dead-letter" list or message queue for later inspection, and an alert is sent. With language models there is a third case: the call succeeds but the output is wrong or does not match the expected format. Builds that rely on structured output typically validate each response and retry or flag it when validation fails.
An example: an order sync pushes orders from a shop into a warehouse system. If the warehouse API is down, the sync retries with backoff for a while; if an order has an invalid postcode, it skips the retries, logs the reason and posts the order to a review channel so someone can fix it.
What it means for cost
Error handling adds build time that is easy to cut from a quote and expensive to add later. Questions that reveal whether it is included:
- What happens to a record when a step fails? Is it retried, logged, or lost?
- Who is alerted, and through which channel?
- Can failed items be rerun safely without creating duplicates? That depends on idempotency.
- Is there a log or dashboard showing failures over time? See observability.
A builder who answers these clearly is pricing a production system. One who does not may be pricing a prototype. Platforms such as n8n include error workflows and retry settings; live figures for those builds are on the n8n workflow cost page.
Common mistakes
The most common mistake is catching an error and carrying on without telling anyone, so data quietly goes missing. The second is retrying everything indefinitely, which can hammer an external service, run up model costs and create duplicate records.
Common questions
How many times should a step be retried?
There is no universal number; three to five attempts with growing gaps is a common starting point for temporary errors. What matters more is that permanent errors are not retried at all and that anything still failing ends up somewhere a person will see it.
Does error handling matter for AI model calls?
Yes, more than for most APIs. Model providers have rate limits and occasional outages, and a model can return a valid response with the wrong content or format. Validating outputs and having a fallback, such as a second model or a review queue, keeps one bad response from breaking a whole run.