Steps
How we tested, and what is real
We ran 35 executions on n8n 2.43.7 with
n8n execute: the Basic LLM Chain (version 1.9) and the AI Agent (version 3.1) with Require Specific Output Format on, the Structured Output Parser (version 1.3) and the OpenAI Chat Model (version 1.3). To get exactly the bad replies real models sometimes give (prose around the JSON, cut-off JSON, a wrong type), we pointed the OpenAI credential's Base URL at a small local stand-in that returns fixed texts. So the model's replies are scripted; n8n's parsing, prompts and error texts are real.n8n wraps your schema in "output"
The format instructions n8n sends to the model ask for
{"output": your schema}, mark every example field as required, setadditionalProperties: falseand say to include the markdown code fence. A good reply lands at$json.output.name, not$json.name. A fenced reply parsed fine."Model output doesn't fit required format": the reply is not valid for the schema
We got this for prose around the JSON, cut-off JSON, a wrong type (
"thirty"for a number), a missing field,null, an array instead of an object, single quotes and a plain sentence. The error never says which. Turn Require Specific Output Format off once, run it, and read$json.textto see the raw reply.Every field in a JSON example is required
With Generate From JSON Example, a missing field or a
nullfailed the run. If a field can be empty, use Define using JSON Schema, put only the must-have fields inrequiredand allow null with"type": ["number", "null"]. Extra fields the model adds are dropped without a warning, so add every field you want to keep to the schema."empty response" when the reply is not empty
In the Basic LLM Chain, a correct object without the
outputwrapper gaveThe AI model returned an empty response to the Structured Output Parser. A really empty reply gives the same text. In the AI Agent the unwrapped object worked; there, the same error appeared when the model called n8n'sformat_final_json_responsetool with cut-off arguments. If you write your own prompt, ask for theoutputwrapper explicitly.One bad reply fails the whole batch
With 2 items, one good and one cut off, the node failed and the good result was lost. With Settings > On Error > Continue (regular output), the good items parsed and the bad one came out as
{"error": "Model output doesn't fit required format"}. Route those with an If node and retry them.Auto-Fix Format: needs a model, and in our run the Responses API off
With Auto-Fix Format on and no model connected to the parser, we only got
Error in sub-node Structured Output Parser. With a model connected and Use Responses API on (the default in the OpenAI Chat Model 1.3), n8n did send a retry and our stand-in answered with valid JSON, but the node still failed. With Use Responses API off, the same retry worked. We did not find the cause, so treat this as one test, not a rule.Cut-off JSON means the reply was too long
Cut-off JSON gave the same generic error; the real reason,
Unexpected end of JSON input, only appeared in the Auto-Fix retry prompt. Raise the model's maximum tokens or ask for fewer fields.
All test results
We ran 35 executions; some rows below group several. Left: what the model replied. Right: what n8n did (real). The replies came from our OpenAI stand-in (scripted, see the first step).
| Test | Result |
|---|---|
Model replies {"output":{"name":"Ann","age":30}} (schema from the JSON example {"name":"Ann","age":30}) | Worked. Result at $json.output.name |
Same reply inside a ```json code fence | Worked |
| "Sure! Here is the JSON: {...} Let me know if..." (prose around the JSON) | Model output doesn't fit required format |
| JSON cut off halfway (reply hit the token limit) | Model output doesn't fit required format; the real reason Unexpected end of JSON input only shows in the Auto-Fix retry prompt |
age sent as "thirty" | Model output doesn't fit required format |
age missing | Same error: every field of a JSON example is required |
age set to null | Same error: null is not allowed unless the schema says so |
Extra field city in the reply | Worked, but city was silently dropped (also with a manual JSON Schema without additionalProperties) |
| An array of two objects when the example is one object | Model output doesn't fit required format |
| Single-quoted pseudo JSON | Model output doesn't fit required format |
| A plain sentence | Model output doesn't fit required format |
Correct object but without the output wrapper: {"name":"Ann","age":30} | Misleading: The AI model returned an empty response to the Structured Output Parser |
| Empty reply | The AI model returned an empty response to the Structured Output Parser |
Manual JSON Schema with required: wrong type, missing field, null | Model output doesn't fit required format each time |
| Require Specific Output Format on, but no parser connected | No error; plain $json.text |
| Require Specific Output Format off, parser connected | Parser ignored; plain $json.text |
| 2 items: one good reply, one cut off | The whole node failed and the good item's result was lost too |
| On Error: Continue (regular output), 3 items good / cut off / good | Items 1 and 3 parsed; item 2 came out as {"error": "Model output doesn't fit required format"} |
| Auto-Fix Format on, model connected to the parser, Use Responses API on (default) | n8n sent a retry with the parse error and our stand-in returned valid JSON, but the node still failed with Model output doesn't fit required format. Cause not isolated |
| Same, with Use Responses API turned off in the OpenAI Chat Model | Auto-Fix worked: the retry was parsed |
| Chat Completions (Responses API off) without Auto-Fix | Same results as with the Responses API: good reply ok, cut-off reply fails |
| Auto-Fix on but no model connected to the parser | Only Error in sub-node Structured Output Parser |
| AI Agent v3.1 + parser: good reply, fenced reply | Worked |
AI Agent: object without the output wrapper | Worked here (the agent accepted it, unlike the Basic LLM Chain) |
| AI Agent: prose, cut-off JSON, wrong type | Model output doesn't fit required format |
AI Agent: model calls the format_final_json_response tool n8n adds, with valid JSON | Worked |
| AI Agent: that tool called with cut-off arguments | The AI model returned an empty response to the Structured Output Parser |
Checklist
- Turn Require Specific Output Format off once and look at
$json.text: that is what the model really answered. - In a Basic LLM Chain the reply must be
{"output": {...}}. A correct object without that wrapper gives the misleadingempty responseerror. - A JSON example makes every field required and forbids null. For optional or nullable fields, switch to a manual JSON Schema, list only the must-have fields in
requiredand use"type": ["number", "null"]. - Fields not in the schema are dropped without a warning: add them to the schema.
- Cut-off JSON: raise the model's max tokens.
- Set On Error to Continue (regular output) so one bad reply does not cost you the whole batch.
- Auto-Fix Format needs its own model connected to the parser; in our run it only worked with Use Responses API off.
Good to know
- Using the parser with a Basic LLM Chain? You need the Require Specific Output Format toggle too: n8n Basic LLM Chain not working.
- Routing items into categories with a model? Dropped items, two-branch items and the fallback key are in n8n Text Classifier not working.
- Pulling fields out of text with the Information Extractor instead? Its hidden fix call, date format and null traps are in n8n Information Extractor not working.
- Other AI Agent errors (
No prompt specified,Max iterations reached, Simple Memory): n8n AI Agent node not working. - Asking for JSON from the plain OpenAI node instead, and the reply stays a string: n8n OpenAI node not working.
- Parsing the model's text yourself in a Code node: n8n Code node errors.
- Every error text from our n8n guides is in the n8n error message index.
What we did not test
Real OpenAI or other model providers (all replies came from our stand-in), why Auto-Fix failed with the Responses API on, the Information Extractor node, the Item List Output Parser, a custom Auto-Fix prompt, streaming and the Chat Trigger, and whether a lower temperature or a stronger model reduces these errors.
Start from a working agent
FAQ
What does "Model output doesn't fit required format" mean in n8n?
The model reply could not be parsed against your Structured Output Parser schema: prose around the JSON, cut-off JSON, a wrong type, a missing field or null. Turn Require Specific Output Format off once to see the raw reply in $json.text.
Why does n8n say "The AI model returned an empty response to the Structured Output Parser"?
The reply was empty, or in the Basic LLM Chain the JSON was not wrapped in {"output": ...}, which n8n expects. In our tests a correct but unwrapped object gave this error.
Why is my Structured Output Parser result under output?
n8n wraps your schema in an output property. Read the fields at $json.output.fieldName.
How do I make a field optional in the n8n Structured Output Parser?
A JSON example makes every field required. Use Define using JSON Schema, leave the field out of required, and allow null with "type": ["string", "null"].
Why are some fields missing from the parser output?
Fields the model added that are not in your schema are dropped without a warning. Add them to the schema.
Why doesn't Auto-Fix Format fix the error?
It needs its own chat model connected to the parser. In our run it also failed with Use Responses API on in the OpenAI Chat Model and worked with it off.
Related guides
- n8n Basic LLM Chain not working? 25 tests, every error decoded
- n8n Information Extractor not working? 27 tests, every error decoded
- n8n Text Classifier not working? 30 tests, every error decoded
- n8n OpenAI node not working? 18 tests, every error decoded
- n8n Summarization Chain not working? 24 tests, every error decoded
New guides
- GitHub release notifications in Slack (any public repo, stable releases only)
- Send RSS feeds to Slack with a keyword filter (free, incoming webhook)
- Forward emails to a Slack channel (Gmail, Outlook, any IMAP), free with an incoming webhook
- n8n Google Sheets Trigger not working: not firing, activation errors and fixes