I dont know how to do solve?

Here is a personal assistant for physical therapy clinics. I have given it a memory to recall patient information, and I am communicating with it as though it were a patient. I think Iroleplayed like it was the second message, and it’s re-reading the whole conversation. How do I stop that error?

Describe the problem/error/question

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

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

Hi @RichardCray Welcome to the community!
You can try increasing the max iteration in the AI agent’s option, if your workflow is suitable, this would work and deliver consistent output.


Open the AI Agent Node > Options > Max Iterations, there you can increase this count.

It could also be due to the wrong choice of AI model used. Can you share the workflow?

Hi @RichardCray Welcome.

That error usually means the AI agent got stuck in a reasoning/tool loop and kept re-processing the conversation until it hit the iteration limit.

Most common fixes in n8n:

  • Reduce how much chat history/memory is injected

  • Limit memory to only recent messages

  • Add clearer system instructions like:
    “Do not re-analyze the full conversation every turn”

  • Disable unnecessary tools/memory retrieval

  • Lower agent complexity (simpler prompt + fewer tools)

  • Increase max iterations only as a last resort

Since you mentioned roleplay/patient chat, I suspect the memory retrieval is repeatedly feeding the whole conversation back into the agent, causing recursive reasoning. The best fix is usually:

  • use short-term memory only

  • summarize old messages instead of passing the full chat each turn

@RichardCray re-reading happens because your memory node dumps the full chat history into context every turn. Swap to Window Buffer Memory with contextWindowLength: 5 so only the last 5 messages replay. Wire it into the AI Agent’s aimemory input alongside your OpenAI Chat Model node. Then add a systemMessage like “Respond only to the latest patient message, do not summarize prior turns” — that stops it re-analyzing previous turns.