[API reference](https://evolu.dev/docs/api-reference) › [@evolu/common](https://evolu.dev/docs/api-reference/common) › [Task](https://evolu.dev/docs/api-reference/common/Task) › RetryOptions

Defined in: [packages/common/src/Task.ts:3855](https://github.com/evoluhq/evolu/blob/037c390af081e9944d616ff298a729515c5c5ab7/packages/common/src/Task.ts#L3855)

Options for [retry](https://evolu.dev/docs/api-reference/common/Task/functions/retry).

## Properties

<a id="onretry"></a>

### onRetry?

```ts
readonly optional onRetry?: (attempt: RetryAttempt<E, Output>) => void;
```

Defined in: [packages/common/src/Task.ts:3875](https://github.com/evoluhq/evolu/blob/037c390af081e9944d616ff298a729515c5c5ab7/packages/common/src/Task.ts#L3875)

Runs before each scheduled retry.

`attempt` is the failed attempt that caused this retry, not the upcoming
attempt number. The callback runs after [RetryOptions.shouldRetry](https://evolu.dev/docs/api-reference/common/Task/interfaces/RetryOptions#shouldretry) and
the [Schedule](https://evolu.dev/docs/api-reference/common/Schedule/type-aliases/Schedule) approve a retry, and before the retry delay. The
callback must not throw: a thrown exception is a defect that panics the
[Run](https://evolu.dev/docs/api-reference/common/Task/interfaces/Run) tree.

### shouldRetry?

```ts
readonly optional shouldRetry?: Predicate<E>;
```

Defined in: [packages/common/src/Task.ts:3864](https://github.com/evoluhq/evolu/blob/037c390af081e9944d616ff298a729515c5c5ab7/packages/common/src/Task.ts#L3864)

Decides whether a domain error should schedule another attempt.

Returning `false` stops retrying and returns [RetryError](https://evolu.dev/docs/api-reference/common/Task/interfaces/RetryError). The
original error is stored as `lastError` instead of returned directly. The
predicate must not throw: a thrown exception is a defect that panics the
[Run](https://evolu.dev/docs/api-reference/common/Task/interfaces/Run) tree.