> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nika.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# retry

> Contract, placement, related fields and source examples for this Nika YAML field.

[Language reference](https://docs.nika.sh/reference/language/overview.md) / `retry`

## Meaning and placement

### task

Retry policy for this task · `{ max_attempts, backoff_ms, backoff_strategy, backoff_max_ms, jitter, on_codes }`. Retries run BEFORE `on_error` sees anything — the catch handles the last error only (spec/05-errors.md §Retry policy).

| Property | Declaration |
| - | - |
| Requirement | Optional in this object |
| Schema location | `/$defs/task/properties/retry` |
| \$ref | `"#/$defs/retry"` |

**In the same object:** [after](https://docs.nika.sh/reference/language/words/after.md) · [agent](https://docs.nika.sh/reference/language/words/agent.md) · [exec](https://docs.nika.sh/reference/language/words/exec.md) · [extract](https://docs.nika.sh/reference/language/words/extract.md) · [for\_each](https://docs.nika.sh/reference/language/words/for_each.md) · [group](https://docs.nika.sh/reference/language/words/group.md) · [infer](https://docs.nika.sh/reference/language/words/infer.md) · [invoke](https://docs.nika.sh/reference/language/words/invoke.md) · [lift](https://docs.nika.sh/reference/language/words/lift.md) · [on\_error](https://docs.nika.sh/reference/language/words/on_error.md) · [returns](https://docs.nika.sh/reference/language/words/returns.md) · [timeout](https://docs.nika.sh/reference/language/words/timeout.md) · [when](https://docs.nika.sh/reference/language/words/when.md) · [with](https://docs.nika.sh/reference/language/words/with.md)

[Schema source (use the pointer above)](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/schemas/workflow.schema.json)

## In a source template

Excerpt from `templates/fanout.nika`, source lines 115–124. This is a fragment, not a runnable workflow.

```yaml illustration theme={"system"}
      max_parallel: 4                 # SLOT: the polite ceiling
      fail_fast: false
    timeout: "60s"                  # SLOT: per-iteration bound
    retry:
      max_attempts: 3
      backoff_strategy: exponential
      jitter: true
    on_error:
      recover: null                 # a failed item yields null at its index · the batch lives
    infer:                          # SLOT: the per-item job (any verb)
```

### Templates containing this field

| Template | Source |
| - | - |
| `templates/fanout.nika` | [Line 118](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/templates/fanout.nika#L118) |
| `templates/recover-optional-file.nika` | [Line 31](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/templates/recover-optional-file.nika#L31) |

These are literal key occurrences in the source files, not an execution or conformance claim. [How to instantiate a template](https://docs.nika.sh/guides/templates.md).

## Contract and implementation

This page projects the named specification revision. Check [released engine status](https://docs.nika.sh/reference/status.md) and [the validation workflow](https://docs.nika.sh/guides/agent-authoring.md) before running a file. An optional field is not evidence that every engine supports every value.

Canonical identity: `language:word:retry`. Spec revision: [`5c40ba456c53`](https://github.com/supernovae-st/nika-spec/tree/5c40ba456c53a4ab663a949d44003078e161305d).

[How documentation stays connected](https://docs.nika.sh/reference/knowledge-system.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.