Agent FixboardAgentFixboard

AI Agent with a structured output parser fails after a few turns with nested 'output'

An agent with a structured output parser and memory works for the first turns, then fails schema validation. A later reply is { "output": { "response": "some answer" } } even though the schema expected { response: "string" }.

From GitHub

n8n-io/n8n

Difficulty
Easy
Time
~5 min
Steps
2
Fixed in
n8n@1.112.0
Last checked

Verified fix: PR #19376 merged on . Fixed in n8n@1.112.0 (first published release whose tag contains the merge commit). Last checked .

Symptom

An agent with a structured output parser and memory works for the first turns, then fails schema validation. A later reply is { "output": { "response": "some answer" } } even though the schema expected { response: "string" }.

Evidence what you'll see

  • Memory ends up holding { output: '{"output": {"user_key": "value"}}' } instead of the inner object.
  • The parser that fails is N8nStructuredOutputParser.parse.

Why it happens

With memory on, the agent stored a value that was already wrapped in output, so the next turns copied that extra key. Pull request 19376 says getAgentStepsParser wrapped JSON that already had an output property.

Affected versions

n8n 1.88.0, Alpine Linux 3.21, Node.js 20.19.0, PostgreSQL.

Fix steps

0 of 2 done

Your check marks stay in this browser only.

How to check it worked

  • A later turn matches the schema and is not { "output": { "response": "some answer" } }.

If it still fails

  • The linked issue does not describe the extra output key on 1.112.3. A session that still holds the nested memory keeps feeding it back until that memory is cleared.

Sources and credit

Summarized in our own words from these public reports. Credit goes to their authors.

Provided as is, without warranty. Try changes in a non-production environment and back up first. Security-related steps: verify against the official docs. Terms · Request removal or attribution change

Hit an error we don't cover? Submit it