> ## 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.

# on_error

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

[Language reference](/reference/language/overview) / `on_error`

## Meaning and placement

### task

The schema declares this field at the location below.

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

**In the same object:** [after](/reference/language/words/after) · [agent](/reference/language/words/agent) · [exec](/reference/language/words/exec) · [extract](/reference/language/words/extract) · [for\_each](/reference/language/words/for_each) · [group](/reference/language/words/group) · [infer](/reference/language/words/infer) · [invoke](/reference/language/words/invoke) · [lift](/reference/language/words/lift) · [retry](/reference/language/words/retry) · [returns](/reference/language/words/returns) · [timeout](/reference/language/words/timeout) · [when](/reference/language/words/when) · [with](/reference/language/words/with)

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

## In a source template

Excerpt from `templates/api-upload-and-create.nika.yaml`, source lines 80–89. This is a fragment, not a runnable workflow.

```yaml illustration theme={"system"}
          - { name: title, value: "Rehearsal item" }   # SLOT: the metadata fields
        mode: jq
        jq: "{ id: .id, url: .url }"   # SLOT: the fields downstream needs
    on_error:
      # Offline rehearsal, NARROWED to the one thing it may forgive: the key is
      # not configured. A `secrets:` entry whose env var is unset fails
      # NIKA-VAR-001 before any byte leaves (measured on 0.118.7 · the run
      # settles « 1 recovered » on that code) — that absence IS the rehearsal
      # switch. Everything else stays loud: a wired key the API rejects is
      # NIKA-BUILTIN-FETCH-001 naming the 401 (measured), a dead endpoint too.
```

### Templates containing this field

| Template                                    | Source                                                                                                                                            |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `templates/api-upload-and-create.nika.yaml` | [Line 83](https://github.com/supernovae-st/nika-spec/blob/c5ebbb7b862b68bc6cf7235efba61173b844afc6/templates/api-upload-and-create.nika.yaml#L83) |
| `templates/chain.nika.yaml`                 | [Line 50](https://github.com/supernovae-st/nika-spec/blob/c5ebbb7b862b68bc6cf7235efba61173b844afc6/templates/chain.nika.yaml#L50)                 |
| `templates/docker-report.nika.yaml`         | [Line 56](https://github.com/supernovae-st/nika-spec/blob/c5ebbb7b862b68bc6cf7235efba61173b844afc6/templates/docker-report.nika.yaml#L56)         |
| `templates/etl-state.nika.yaml`             | [Line 80](https://github.com/supernovae-st/nika-spec/blob/c5ebbb7b862b68bc6cf7235efba61173b844afc6/templates/etl-state.nika.yaml#L80)             |
| `templates/fanout.nika.yaml`                | [Line 105](https://github.com/supernovae-st/nika-spec/blob/c5ebbb7b862b68bc6cf7235efba61173b844afc6/templates/fanout.nika.yaml#L105)              |
| `templates/gate-and-act.nika.yaml`          | [Line 60](https://github.com/supernovae-st/nika-spec/blob/c5ebbb7b862b68bc6cf7235efba61173b844afc6/templates/gate-and-act.nika.yaml#L60)          |
| `templates/human-gated-ship.nika.yaml`      | [Line 99](https://github.com/supernovae-st/nika-spec/blob/c5ebbb7b862b68bc6cf7235efba61173b844afc6/templates/human-gated-ship.nika.yaml#L99)      |
| `templates/media-asset-pack.nika.yaml`      | [Line 79](https://github.com/supernovae-st/nika-spec/blob/c5ebbb7b862b68bc6cf7235efba61173b844afc6/templates/media-asset-pack.nika.yaml#L79)      |
| `templates/website-brief.nika.yaml`         | [Line 56](https://github.com/supernovae-st/nika-spec/blob/c5ebbb7b862b68bc6cf7235efba61173b844afc6/templates/website-brief.nika.yaml#L56)         |

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

## Contract and implementation

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

Canonical identity: `language:word:on_error`. Spec revision: [`c5ebbb7b862b`](https://github.com/supernovae-st/nika-spec/tree/c5ebbb7b862b68bc6cf7235efba61173b844afc6).

[How documentation stays connected](/reference/knowledge-system).
