URGENT: Problem with STREAMING Response when trying structured Output Parser

To make it short: Is there any way to use the structured output Parser together with the Streaming API cause the way I use it, it tries to Structure the Output for every snippet so to speek whcih leads to a "Max iterations (10) reached. The agent could not complete the task within the allowed number of iterations.
" error

Information on your n8n setup

  • n8n version: 2
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Win 11
1 Like

The issue here is that the Structured Output Parser is trying to parse each streaming chunk individually, which causes it to hit the iteration limit. To fix this:

1. Disable streaming in the OpenAI node

2. Use the Structured Output Parser on the complete response

3. If you need streaming, implement custom logic to buffer chunks until complete before parsing

This approach ensures the parser only runs once on the full response. Let me know if you need help implementing the buffering logic!