JSON mode guarantees valid JSON and says nothing about your keys, so a required field can go missing and the output still parses. Five checks, each sized for an afternoon, put a strict schema, a stop-reason test, a validator and a retry-then-park path before your database.
One gate per endpoint, before the database
decoding: strict_json_schema # not JSON mode
schema:
every_key_required: true # at every nesting level
additional_properties: false # on every object
optional_field: union_with_null
before_parse: {refusal: send_to_person, token_limit: retry_once}
validate_in_code: [required_keys, ranges, lengths, enum_values]
on_failure:
retries_with_error: 1 # one framework's default
then: review_queue # never the databaseThe checks
Everything starts ticked. Untick what you will not do; the choice is saved on this device only, and Print keeps only what you kept.
What happened. One provider's guide says both modes ensure valid JSON, but only structured outputs ensure schema adherence. In its 2024 evals of complex schema following, one model with strict decoding scored 100%, an earlier model under 40%: what can happen, not every model.
The check.
- Move each call from JSON mode to a strict JSON-schema response format, one endpoint at a time.
- Replay saved production prompts through both paths and count missing keys.
Source: Structured model outputs, a model API provider's guide, read 27 Oct 2026; Introducing structured outputs in the API, 6 Aug 2024
What happened. In JSON Schema, properties are not required by default and extra properties are allowed, so an object missing your key is valid. One platform's guide asks for every field as required, additionalProperties false, and a null union for optional fields.
The check.
- List every key in required at every nesting level; set additionalProperties to false on every object.
- Write an optional field as a type union with null, so the key is always present.
{"type": "object", "required": ["id", "unit"],
"properties": {"id": {"type": "string"}, "unit": {"type": ["string", "null"]}},
"additionalProperties": false}Source: JSON Schema reference, object: required and additional properties, read 27 Oct 2026; Structured outputs, cloud platform documentation, updated 24 Aug 2026
What happened. One provider's guide lists cases where output might not match the schema: a refusal, whose message takes precedence over the schema, and a response cut off at the token limit, which might be incomplete. One client library raises an error on length and content-filter stops.
The check.
- Read the refusal field and the stop reason first; parse only when the run ended normally.
- Send a refusal to a person; on a token-limit stop, retry once with a higher limit.
Source: Structured outputs, a model API provider's documentation, read 27 Oct 2026; Helpers for structured outputs, a client library's documentation, read 27 Oct 2026
What happened. The same guide lists minimum, maximum and string-length constraints as unsupported in schemas and does not guarantee enum capitalization; its validating helper still enforces every constraint in your code. A validation library raises an error on invalid data.
The check.
- Check every response against all constraints: required keys, ranges, lengths, enum values.
- On failure, discard the whole object; do not fill defaults, trim values or fix keys by hand.
data = json.loads(text)
missing = REQUIRED - data.keys()
if missing or not 0 < data["qty"] <= 1000:
return retry_or_park(text, sorted(missing))Source: Structured outputs, a model API provider's documentation, read 27 Oct 2026; Models, a validation library's documentation, read 27 Oct 2026
What happened. One agent framework validates output, tells the model to try again on failure, and defaults its output retry budget to 1. A receiver that cannot process a message should move it to an invalid message channel.
The check.
- Retry once, adding the validation error and the failed object to the prompt; log each retry.
- After a second failure, send the object to a review queue, not the database; alert on growth.
Source: Output, an agent framework's documentation, read 27 Oct 2026; Invalid Message Channel, enterprise integration pattern, read 27 Oct 2026
The 100% and under 40% are one lab's 2024 evals of one model: what can happen, not every model. Limits are as documented on 27 Oct 2026. The retry count of 1 is one framework's default; effort is a planning estimate; code values are examples.
Take this list with youThe PDF is the handout: this list on one or two pages. The Markdown is for your own docs, your wiki, or an assistant you want to hand the list to. Print gives you this list only, without the navigation.
Something in your production AI broke in a way that is not on this list? Tell me what broke.