Im pretty new to n8n, Ive made 3-4 workflows till date. I have used output parser before but it is giving the “output doesn’t fit required format” error even when I dont see anything wrong with the input the AI agent is sending. I’ve tried troubleshooting it with claude multiple times, still not fixed. Can anyone tell me whats wrong? Attached the Output Parser JSON example.
{
"type": "object",
"properties": {
"reply": {
"type": "string"
},
"customer_name": {
"type": "string"
},
"property_interest": {
"type": "string"
},
"budget_raw": {
"type": "string"
},
"budget_numeric": {
"type": "number"
},
"timeline": {
"type": "string"
},
"lead_score": {
"type": "string",
"enum": ["hot", "warm", "cold"]
},
"status": {
"type": "string",
"enum": ["new", "in_progress", "qualified"]
}
}
}
Hey @dikshxnt, while you wait for a response, here are some things that might help:
Suggested resources
Automatically matched to your question.
Docs:
Forum:
@Vaclav_Soukup, @mk_n8n, @Manasgupta840 - you’ve helped with similar issues before, can you take a look?
Automatically suggested by n8n’s community bot. It’s a pilot - please share feedback here.
Hi @dikshxnt Welcome!
What you pasted is a JSON Schema, not a JSON example, and the parser’s two Schema Type options are not interchangeable. On “Generate from JSON Example” the node reads the property names of whatever you paste and makes every one mandatory, so it builds a schema demanding literal type and properties keys, which the agent will never return. That fails on every run while the agent’s own output looks perfectly fine.
Open the Structured Output Parser and set Schema Type to “Define using JSON Schema”, leaving the content exactly as it is.
If it was already on that setting, the next suspects are budget_numeric typed as number against a model returning something like “1.2M” as text, and the two enums rejecting a capitalised Hot or New.
Hi @dikshxnt ,
This error usually happens for two main reasons when using output parsers with AI Agents in n8n.
First, your JSON schema is missing the required array at the top level. Without explicitly telling the parser which fields are mandatory, it often fails validation when the model skips a key or returns empty values.
Second, you have strict enums for lead score and status, plus a strict number type for budget numeric. LLMs frequently output capitalized words like Hot instead of lowercase hot, or pass string text into budget numeric when no number is mentioned in the conversation. Any minor format mismatch triggers that exact error.
Update your schema to include top-level required fields, and add a quick instruction in your AI Agent system prompt to enforce lowercase enums and fallback values.
Here is the updated JSON schema to paste into your parser:
{
"type": "object",
"properties": {
"reply": { "type": "string" },
"customer_name": { "type": "string" },
"property_interest": { "type": "string" },
"budget_raw": { "type": "string" },
"budget_numeric": { "type": "number" },
"timeline": { "type": "string" },
"lead_score": { "type": "string", "enum": ["hot", "warm", "cold"] },
"status": { "type": "string", "enum": ["new", "in_progress", "qualified"] }
},
"required": [
"reply",
"customer_name",
"property_interest",
"budget_raw",
"budget_numeric",
"timeline",
"lead_score",
"status"
]
}
Also add this line to your AI Agent system prompt:
Always output strictly lowercase values for lead_score and status. If budget_numeric is unknown, always output 0 instead of text or null.
Hope this helps!
Thanks!
(post deleted by author)