# Automatic Retrying

## Introduction

Locoia has an **automatic retry logic for failed flows** to handle third party timeouts, downtimes, rate limits, etc.. This makes it very convenient that if something goes wrong along the way your data and any temporarily generated data is stored and can be reused in order to continue exactly where the Flow Run was unintentionally stopped.

Automatic retrying is turned on by default, but can be turned off on a per Flow basis in the Flow's settings.

![](/files/eD5kJKIbPDU7B7UY2w3y)

## Possible reasons for failure

* Flow is setup or built incorrectly
* Flow is built to process data in a certain way, but there may be data inconsistencies from time to time, as usual in data handling.
* Systems or APIs that flows interact with may be down or temporarily out of service.
* Systems or APIs may have rate limits allowing only a certain number of API calls per time unit, e.g. 100 per minute is often used.

## How flow failure is handled - smart retries

There are three different groups of errors, which have different retry logics:

| Groups                                                                                                                                      | Retryable, with a long delay                                                                                                                                                                                                                               | Retryable, with a short delay                                                                                                                                                                       | Non-retryable                                                                                                                                                                                   |
| ------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Applies to all** [**Connectors**](/connectors/connectors.md) **and the following Helpers**                                                | [Rest Helper](/connectors/helpers/rest-helper.md)                                                                                                                                                                                                          | <p><a href="/pages/-Mg6fYnEj2YFVTXckIY_">Rest Helper</a><br><a href="/pages/-Me_2G8sulDa_VOnhBh-">FTP Helper</a><br><a href="/pages/-Me_2NIPAYiO5xPYn5va">SQL Connector</a></p>                     | [All Helpers](/connectors/helpers.md)                                                                                                                                                           |
| <p><strong>Applicable errors</strong><br><strong>(Checks from left to right, if any of the cases are applicable \['OR' check])</strong></p> | <ul><li>HTTP status codes <code>429</code>, <code>503</code></li><li><code>Retry-After</code> or <code>X-RateLimit-Reset</code> header is specified (except for <code>2xx</code> status codes)</li></ul>                                                   | <ul><li>HTTP status is <code>5xx</code> (except for <code>503</code>)</li><li>DNS resolution failed</li><li>Network connection was abruptly closed</li><li>Generic network error happened</li></ul> | <ul><li>HTTP status is <code>4xx</code> (except for <code>429</code>)</li><li>User input contains Jinja syntax errors</li><li>+ All errors that didn’t fall into the first two groups</li></ul> |
| **Retrying behavior**                                                                                                                       | <p>Retry once based on the <code>Retry-After</code> or <code>X-RateLimit-Reset</code> header or, if not set, after 3 minutes.<br>If the <code>Retry-After</code> header specifies a value higher than 10 minutes, retrying will not take place at all.</p> | Retry after 1 second, regardless of Flow status and [custom error handling](/automation/flow-builder/custom-error-handling.md) settings.                                                            | No retrying                                                                                                                                                                                     |
| **Visibility in Flow Debugger while retrying**                                                                                              | Flow Run and Flow Run Step have status `retrying`                                                                                                                                                                                                          | Flow Run and Flow Run Step have status `running`                                                                                                                                                    | N/A                                                                                                                                                                                             |

For all retry groups an [error email](/automation/flow-builder/flow-run-data-retention-and-logging.md#error-notifications) will be sent once the Flow Run's status changed to `error` (i.e. once retrying has taken place).

[Error Handling Flows](/automation/flow-builder/error-handling-flows.md) will be triggered for each error Flow Run Step, even if it is being retried successfully.

{% hint style="warning" %}
When the [Flow's data retention](/automation/flow-builder/flow-run-data-retention-and-logging.md) is set to 0 and an error occurs in one of the steps that falls into the first group, this step's contents will be temporarily stored and displayed in the Flow Debugger in order to make retrying possible.

In case you don't want this to happen, automatic retrying has to be disabled for the Flow
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.locoia.com/automation/flow-debugger/automatic-retrying.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
