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

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

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

## Meaning and placement

### retry

Retry ONLY on these canonical `NIKA-&lt;NS&gt;-&lt;NNN&gt;` codes · absent, the engine retries anything transient. Codes, never HTTP status numbers · the retry-side mirror of `on_error.on_codes`.

| Property        | Declaration                        |
| --------------- | ---------------------------------- |
| Requirement     | Optional in this object            |
| Schema location | `/$defs/retry/properties/on_codes` |
| type            | "array"                            |

**In the same object:** [backoff\_max\_ms](/reference/language/words/backoff_max_ms) · [backoff\_ms](/reference/language/words/backoff_ms) · [backoff\_strategy](/reference/language/words/backoff_strategy) · [jitter](/reference/language/words/jitter) · [max\_attempts](/reference/language/words/max_attempts)

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

### onError

Optional catch-side filter (mirror of retry.on\_codes · same regex) · the action applies ONLY when the final error code is listed · unlisted codes fall through to the default fail (spec/05-errors.md §Fields).

| Property        | Declaration                          |
| --------------- | ------------------------------------ |
| Requirement     | Optional in this object              |
| Schema location | `/$defs/onError/properties/on_codes` |
| type            | "array"                              |

**In the same object:** [recover](/reference/language/words/recover) · [skip](/reference/language/words/skip)

[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 92–99. This is a fragment, not a runnable workflow.

```yaml illustration theme={"system"}
      # answering 401). The literal is shaped EXACTLY like what the jq above
      # projects, so `outputs.result` has the same shape on both paths. Delete
      # the block once the key is wired, so an unset key is loud as well.
      on_codes: [NIKA-VAR-001]
      recover: { id: "rehearsal-0001", url: "https://app.example.com/items/rehearsal-0001" }

outputs:
  result: ${{ tasks.create.output }}   # SLOT: the callable contract
```

### Templates containing this field

| Template                                    | Source                                                                                                                                            |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `templates/api-upload-and-create.nika.yaml` | [Line 95](https://github.com/supernovae-st/nika-spec/blob/c5ebbb7b862b68bc6cf7235efba61173b844afc6/templates/api-upload-and-create.nika.yaml#L95) |
| `templates/chain.nika.yaml`                 | [Line 59](https://github.com/supernovae-st/nika-spec/blob/c5ebbb7b862b68bc6cf7235efba61173b844afc6/templates/chain.nika.yaml#L59)                 |
| `templates/etl-state.nika.yaml`             | [Line 81](https://github.com/supernovae-st/nika-spec/blob/c5ebbb7b862b68bc6cf7235efba61173b844afc6/templates/etl-state.nika.yaml#L81)             |
| `templates/human-gated-ship.nika.yaml`      | [Line 105](https://github.com/supernovae-st/nika-spec/blob/c5ebbb7b862b68bc6cf7235efba61173b844afc6/templates/human-gated-ship.nika.yaml#L105)    |

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_codes`. Spec revision: [`c5ebbb7b862b`](https://github.com/supernovae-st/nika-spec/tree/c5ebbb7b862b68bc6cf7235efba61173b844afc6).

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