Simple Memory Node Not Isolating Sessions Correctly (Session ID Issue)

Simple Memory Node Not Isolating Sessions Correctly (Session ID Issue)

Hello n8n Community,

I’m currently working on a chatbot project using n8n Cloud (free tier) and I’m encountering a persistent issue with the Simple Memory node that I can’t seem to resolve, despite extensive debugging.

Project Overview:
I have a web-based chatbot (HTML/JavaScript frontend) that communicates with an n8n webhook. The n8n workflow uses an AI Agent (connected to Google Gemini) for chatbot logic and aims to store conversation history using the Simple Memory node. User and bot messages, along with a unique sessionId (UUID generated on the frontend), are then passed through the workflow.

The Problem:
The Simple Memory node does not appear to be isolating chat history based on the provided sessionId. Even when I open the chatbot on different devices or in new Incognito/Private browser windows, the bot continues the conversation from a previous session, as if it’s using a single, global memory store instead of creating/retrieving memory per sessionId.

What I’ve Already Checked and Confirmed:

  1. Frontend sessionId Generation: The frontend successfully generates a unique UUID for sessionId for each new browser session (or when localStorage is cleared).
  2. Webhook Input: The Webhook node correctly receives the userMessage and the sessionId within the body of the incoming JSON. For example, the input to the Simple Memory node consistently contains a unique sessionId like "fbafe9c1-5b6d-49e5-9f3d-f56741a24515".
  3. Edit Fields Node: A preceding Edit Fields node correctly transforms {{ $json.body.userMessage }} into a body field that contains the user’s message.
  4. AI Agent Node Prompt: The Prompt (User Message) field in the AI Agent node is correctly set to {{ $json.body }}.
  5. Simple Memory Node Configuration:
    • Session ID is set to {{ $json.body.sessionId }} (and it’s confirmed to be recognized as an expression, not plain text).
    • Key is set to userMessage.
    • Context Window Length is 50.
  6. Simple Memory Node Behavior: Despite a unique sessionId being passed into the Simple Memory node’s INPUT, the chatHistory in its OUTPUT (and thus passed to the AI Agent) often contains messages from previous, unrelated sessions. It seems the memory is not being correctly partitioned by the sessionId. For instance, if a new session starts with “hello,” the chatHistory might still include “smart fridge” from an earlier, distinct session.
  7. Debugging Steps: I’ve tried deactivating and reactivating the workflow in n8n Cloud, and testing with clean browser sessions (incognito mode), but the issue persists.

My Question:
Given that the sessionId is correctly transmitted and configured in the Simple Memory node, what could be causing the memory not to be isolated per session? Is this a known limitation or bug with the Simple Memory node, especially on the free tier of n8n Cloud? Or am I missing a crucial configuration step for proper session isolation?

Any help or insights would be greatly appreciated!

Thank you!

I can confirm - this is happening to me also. I was about to post my question about it.

I’m using n8n cloud (paid tier). I’ve discovered a problem with my n8n ChatBot. My AI Agent is using Simple Memory and the Session ID (the default method). Although I do set the Session ID in a Set and use that throughout the workflow.

Has anyone else had a problem with Simple Memory? I could change to Postgres Chat Memory or Redis, but based on the Execution logs… I’m not certain that will fix the problem.

It appears to be appending a prior SessionID’s simple memory to the AI Agent System Message. Checking the Execution log I can verify the SessionID is different from the prior session.

Does Simple Memory append to the System prompt? I would expect it would instead use:

[
{ “role”: “user”, “content”: “{prior msg}” },
{ “role”: “assistant”, “content”: “{prior msg}” }
]

… methodology.

This is definitely a serious problem. Having n8n pull in information from a prior session Simple Memory is a security flaw.