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

# Structured Output Retries Exhausted

> The model kept producing structured output that failed schema validation on every retry attempt.

**Surface:** `GET /agents/runs/{id}`, `error.type = "AgentLoopStructuredOutputRetriesExhausted"`

## When this error occurs

When the model emits a final structured answer, the platform validates it against the run's
`output_format_schema`. A validation failure no longer fails the run outright — instead the
workflow feeds the failure back to the model (the non-conforming output plus the validator's
explanation) and asks it to try again. This error means every one of those retries also failed
validation, so the workflow gave up.

* The retry budget is a fixed **10 attempts** — separate from `max_iterations`, which bounds
  productive tool-use rounds rather than these corrective re-prompts.
* Each retry is one inference job, so a run that hits this error has spent 11 inference jobs on
  the final answer alone (the first attempt plus 10 retries).
* Distinct from [Output Schema Decode Failed](./schema-decode-failed): that one is a single,
  non-retried decode failure of the final answer; this one is the terminal state after the retry
  loop is exhausted.

## How to fix

* **Simplify the schema** — Bedrock's structured-output sampler enforces a subset of Draft
  2020-12; deeply nested or exotic constructs (e.g. unconstrained `oneOf`) are the most common
  reason the model can't produce a conforming object even when re-prompted.
* **Reinforce the schema in the system prompt** — tell the model explicitly what shape to emit
  and which fields are required. A schema the sampler struggles with is often one the model was
  never steered toward in the instructions.
* **Inspect the last `failed_structured_output`** on the final inference job's result — it holds
  the raw JSON the model produced and the validator's message, which pinpoints the field that
  keeps failing.
