Skip to content

When using “chat memory manager”, the information is not recorded completely #15849

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tigflanker opened this issue May 30, 2025 · 1 comment
Labels
in linear Issue or PR has been created in Linear for internal review

Comments

@tigflanker
Copy link

Bug Description

Hello n8n developers, when I was using the “chat memory manager”, I found that the information was not recorded completely.
I only set up two chat memory manager modules, the first one to record user input, and the second one to read it.
However, when I input in the order of 1, 2, 3, 4, 5, 6, 7, I found that the memory module did not correctly record the information.

The pattern seems to be: the first time it records normally, the second time it overwrites the first record; the third time it extends the record normally (at this point there are two records), the fourth time it overwrites the third record.

Image

Image

To Reproduce

Here is the workflow:

{
"nodes": [
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"typeVersion": 1.1,
"position": [
-540,
0
],
"id": "56adf3f1-6dc5-42b6-ae44-775f90412175",
"name": "When chat message received",
"webhookId": "e20be05c-d689-401d-9b59-1dcb9bd3ff36"
},
{
"parameters": {
"mode": "insert",
"messages": {
"messageValues": [
{
"type": "user",
"message": "={{ $json.chatInput }}"
}
]
}
},
"type": "@n8n/n8n-nodes-langchain.memoryManager",
"typeVersion": 1.1,
"position": [
-320,
0
],
"id": "d655e19a-afd5-4122-8717-a8e3b055ad57",
"name": "Chat Memory Manager"
},
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.memoryManager",
"typeVersion": 1.1,
"position": [
56,
0
],
"id": "f46b34c8-fe0b-493a-8189-cd1c882c3c8f",
"name": "Chat Memory Manager1"
},
{
"parameters": {
"contextWindowLength": 20
},
"type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
"typeVersion": 1.3,
"position": [
-240,
220
],
"id": "c880c1fc-945a-4b1a-917d-20105cf2e32c",
"name": "Postgres Chat Memory",
"credentials": {
"postgres": {
"id": "NJGoko5aK43WWtl1",
"name": "Postgres account"
}
}
},
{
"parameters": {
"sessionIdType": "customKey",
"sessionKey": "={{ $('When chat message received').item.json.sessionId }}",
"contextWindowLength": 20
},
"type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
"typeVersion": 1.3,
"position": [
160,
220
],
"id": "aa7d65fb-6f4c-4c6a-81d4-b804bd1578b2",
"name": "Postgres Chat Memory1",
"credentials": {
"postgres": {
"id": "NJGoko5aK43WWtl1",
"name": "Postgres account"
}
}
}
],
"connections": {
"When chat message received": {
"main": [
[
{
"node": "Chat Memory Manager",
"type": "main",
"index": 0
}
]
]
},
"Chat Memory Manager": {
"main": [
[
{
"node": "Chat Memory Manager1",
"type": "main",
"index": 0
}
]
]
},
"Postgres Chat Memory": {
"ai_memory": [
[
{
"node": "Chat Memory Manager",
"type": "ai_memory",
"index": 0
}
]
]
},
"Postgres Chat Memory1": {
"ai_memory": [
[
{
"node": "Chat Memory Manager1",
"type": "ai_memory",
"index": 0
}
]
]
}
},
"pinData": {},
"meta": {
"templateId": "PT1i+zU92Ii5O2XCObkhfHJR5h9rNJTpiCIkYJk9jHU=",
"templateCredsSetupCompleted": true,
"instanceId": "6c539a3c2a224c3bfb4e755552bac62e8eab064df7b664034faaed76747796b9"
}
}

Expected behavior

As above.

Operating System

Ubuntu 2204

n8n Version

1.94.1

Node.js Version

docker used

Database

SQLite (default)

Execution mode

main (default)

@Joffcom
Copy link
Member

Joffcom commented May 30, 2025

Hey @tigflanker,

We have created an internal ticket to look into this which we will be tracking as "GHC-2253"

@Joffcom Joffcom added the in linear Issue or PR has been created in Linear for internal review label May 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in linear Issue or PR has been created in Linear for internal review
Projects
None yet
Development

No branches or pull requests

2 participants