New: Cookbooks and AI ExplanationsStep-by-Step recipes to solve problems connected to Roadmaps and Cheat Sheets. Need more details? Use AI buttons for structured and simple explanations with concrete examples throughout the whole platform.Take a look
My parser crashed on a completely ordinary question, and it turned out the model had refused and sent back no data at all.
What you'll have at the end
A response handler that shows a clear fallback message on a refusal instead of throwing a parsing error
You need
A structured-output call already wired into a real intake path, built against a typed schema, that reads a field straight off the parsed result without first checking whether the call actually returned one.
Not covered
Rewording the prompt to make a decline less likely in the first place, and automatically retrying a declined call on a different model: this recipe only covers recognizing a decline, on whichever provider sent it, and giving the reader something useful the moment it happens.
Leans on
Resubmit a rejected reply with the schema error attached
the reply fails schema validation instead of declining outright, and you want it to see the exact error and try again.
Write one JSON Schema that satisfies OpenAI and Claude's strict mode
you also need the schema itself to satisfy two providers' strict-mode rules, beyond handling a decline from either one.
Checked 15 Aug 2026
Part of the Structured Output Generation with LLMs cookbook