Problem with simple memory node

Dear n8n Community,

Describe the problem/error/question

I tried to create an AI agent following the YouTube instructions. Unfortunately, an error occurs after inserting the “simple memory node.”

I first set up a Telegram trigger.

From there, it goes to a switch node that distinguishes between voice and text messages. {{ $json.message.text }} or {{ $json.message.voice.file_id }}

The text message is edited from “message.text” to “text.”

Then it goes to the AI ​​agent. Without the memory node, the output via Telegram works.

When I now insert the memory node and trigger the workflow, the memory node flashes green briefly, but then turns red as shown in the image.

What is the error message (if any)?

Cannot create property ‘additional_kwargs’ on number ‘6407142739’

{
“nodes”: [
{
“parameters”: {
“promptType”: “define”,
“text”: “={{ $(‘Switch’).item.json.message.chat.id }}”,
“options”: {
“systemMessage”: “=# ROLLE\nDu bist ein freundlicher und hilfreicher Agent.\n\n# EXTRA INFORMATION\nDu sprichts gerade mit {{ $(‘Switch’).item.json.message.from.first_name }}”
}
},
“type”: “@n8n/n8n-nodes-langchain.agent”,
“typeVersion”: 1.8,
“position”: [
1320,
0
],
“id”: “55a1acc1-f13b-4d5a-a6d0-2f64fc8b1d76”,
“name”: “AI Agent”
}
],
“connections”: {
“AI Agent”: {
“main”: [

]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “31ca1c67a3c7e76535e44397c465cad5d69925544f50cfe7ba32b9a7bf7a61fc”
}
}

Please share your workflow

KI-Agent

{
“nodes”: [
{
“parameters”: {
“promptType”: “define”,
“text”: “={{ $(‘Switch’).item.json.message.chat.id }}”,
“options”: {
“systemMessage”: “=# ROLLE\nDu bist ein freundlicher und hilfreicher Agent.\n\n# EXTRA INFORMATION\nDu sprichts gerade mit {{ $(‘Switch’).item.json.message.from.first_name }}”
}
},
“type”: “@n8n/n8n-nodes-langchain.agent”,
“typeVersion”: 1.8,
“position”: [
1320,
0
],
“id”: “55a1acc1-f13b-4d5a-a6d0-2f64fc8b1d76”,
“name”: “AI Agent”
}
],
“connections”: {
“AI Agent”: {
“main”: [

]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “31ca1c67a3c7e76535e44397c465cad5d69925544f50cfe7ba32b9a7bf7a61fc”
}
}

Memorynode:

{
“nodes”: [
{
“parameters”: {
“sessionIdType”: “customKey”,
“sessionKey”: “={{ $(‘Telegram Trigger’).item.json.message.chat.id }}”,
“contextWindowLength”: 30
},
“type”: “@n8n/n8n-nodes-langchain.memoryBufferWindow”,
“typeVersion”: 1.3,
“position”: [
1440,
200
],
“id”: “1968ecb5-e489-43dc-b555-bb95779c0f73”,
“name”: “Simple Memory”
}
],
“connections”: {
“Simple Memory”: {
“ai_memory”: [

]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “31ca1c67a3c7e76535e44397c465cad5d69925544f50cfe7ba32b9a7bf7a61fc”
}
}

Share the output returned by the last node

Cannot create property ‘additional_kwargs’ on number ‘6407142739’

Information on your n8n setup

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

What am I doing wrong? What can I do?

Thank you for your help.

Best regards,
Andreas

To use the Simple Memory, you need to pass a sessionId, when using without Chat trigger.

I suggest to place am Edit node right before the Agent node

  • Check Include Other Input Fields
  • add the sessionId
  • optionally set / modify chatInput
1 Like

Thank you for your answer.

I’ll try it that way.

The error remains the same.

I hope I implemented it correctly.

image

This must be sessionId

The Error remains:

{
“nodes”: [
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “95e85dda-c46d-4605-82f4-dd7c9da19fb1”,
“name”: “sessionId”,
“value”: “={{ $execution.id }}”,
“type”: “string”
}
]
},
“includeOtherFields”: true,
“options”: {}
},
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
1320,
0
],
“id”: “81b14efe-cd0b-4adb-9031-716e8e5262a2”,
“name”: “Edit Fields1”
}
],
“connections”: {
“Edit Fields1”: {
“main”: [

]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “31ca1c67a3c7e76535e44397c465cad5d69925544f50cfe7ba32b9a7bf7a61fc”
}
}

Sorry.

It did work.

Thank you very much for your help.

Hi, I see you’re having the same problem.

You can solve it by setting the Telegram Trigger ID to Simple Memory.

Simple Memory Settings
Define below
Key

message_id ---- X
Id: ----- ok

And that’s it

Hello,

I am very new to the N8N community so this question may seem under informed, but what are you actually putting into your simple memory settings?

I dragged the message id schema into my simple memory key, but I am still getting the same error as before.