JSON Output Parser

I’m trying to setup the json parser on my end but it occasionally runs into this error:

AI Agent error output:
Model output doesn't fit required format

Json output parser output:

  {
    "action": "parse",
    "response": {
      "output": {
        "value 1": "actual value",
        "value 2": "actual value"
      }
    }
  }
]

Json example that I gave:

{
	"value 1": "output 1",
	"value 2": "output 2"
}

Am i missing something?

Information on your n8n setup

  • n8n version: 1.71.1
  • Database (default: SQLite): Postgres
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker

I have exactly the same problem. I’ve set up JSON output parser with configured schema and still getting this error even when the response fits schema.

Yeah :confused: I tried to take a really good look at both working outputs and non working outputs but there is basically no difference in the schema…

Oh and the auto fixing tool usually can’t fix this either

It might be due to the model you use. More sophisticated models could do better.

1 Like

I was using the newest claude sonnet

Same issue here with Gemini Model. OpenAI responds properly as needed.

Seems like Gemini is responding properly yet the Node is not accepting it

1 Like

OpenAI is failing 50% of the time for me.

GPT-4o is doing it

Hey all! Just heard from the AI team that generally an AI Agent is going to be less reliable in using Structured Output parser. Guidance for today is if you need AI Agent with structured output then first have agent step, then afterwards pipe it’s output into a Basic LLM Chain with structured output parser.

If you don’t need an AI Agent, use a Basic LLM chain to start with (with structured output).

The team is going to be picking this issue up soon to improve structured output nonetheless, as we see how important it is.

7 Likes

Great! Thanks max

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.