N8n chat trigger failing to fetch previous messages (loadPreviousSession)

The n8n workflow involving a chat trigger fails to fetch previous messages using a session ID stored in a buffer memory node.

What is the error message?

{
    "code": 0,
    "message": "Workflow Webhook Error: Workflow could not be started!"
}


Information on your n8n setup

  • n8n version: 1.46.0
  • Database: SQLite (default)
  • n8n EXECUTIONS_PROCESS setting: Own, Main (default)
  • Running n8n via: Docker

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

@jan @Jon could you have a look into this!!

Hey @Roney_Dsilva,

Can you share a screenshot of the execution that fails? I have given your flow a quick go and it is telling me that a tool is needed with the AI Agent node so I am curious to know if the UI is telling you that you need a tool and maybe the conversational agent is the better option.

Hi @Jon,
Sure.



it fails for loadPreviousSession action as the sessionId is not being passed to the Memory node.

@Jon ,

you’ll be able to replicate this issue using the chattrigger and buffer node only, no need for the Agent .

Hey @Roney_Dsilva,

That workflows shows a different error message…

“Chat only works when an AI agent or chain(except summarization chain) is connected to the chat trigger node”

As a quick test the below workflow appears to be working ok.

How are you running the chat trigger?

Hi @Jon ,
Am triggering it using @n8n/chat - npm
So basically when the page is loaded it sends out the below POST request with action “loadPreviousSession”, and this call fails in the n8n workflow as the sessionId passed in the POST is not outputed by the Chat Trigger node for the case when action is “loadPreviousSession”.

To replicate this, just add the below code to a html page, reload the page, open network tab, open the chat icon, you will observe the call being made to load previous chat history fails:

@Jon any update on this?

Hi @Roney_Dsilva, I just looked into this, and it seems related to connecting the memory node to both the agent and the chat trigger. If you use an expression for getting the session id, this will not work well for the memory buffer in the chat trigger. Can you try to use two separate memory buffer nodes, where the chat trigger one uses the “take from previous node” mode? That should hopefully resolve your issue.

3 Likes

Thanks @jpvanoosten.
That worked :slightly_smiling_face:

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