Bad request error after linking simple memory node

Before linking my memory node, the workflow can run successfully. After linking there is an error saying: ‘Bad request - please check parameter, Invalid value for ‘content’: expected a string, got null.’ Error is on both the ai agent model and open ai chat model. How can I fix this?


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:

Make sure you pass the sessionId to the Simple Memory node. You can take it from the trigger (e.g., {{ $('Telegram Trigger').item.json.message.chat.id }}) and define it with a Set/Edit node before the Simple Memory node.

Update the Simple Memory node, delete the current node, and reinsert it to ensure you’re using the latest version.

Check the input fields properly. Don’t pass numbers or null values; sessionId must be a valid string or expression. Make sure the AI ​​Agent node is properly connected to the Memory node, receiving both context and the chat model.


it is currently taking from the trigger, with the wa_id (phone number) as the key. I have recreated the node, but it still does not work

This WhatsApp message comes from the WhatsApp Cloud trigger?

Can you share the output of the whatsapp trigger node. You’re supposed to use an id tied to the conversation so that the memory can reference conversation secific context

This is the output of the whatapp trigger

},

"contacts": [

{

"profile": {

"name": "Kai"

},

"wa_id": "6597861900"

}

],

"messages": [

{

"from": "6597861900",

"id": "wamid.HBgKNjU5Nzg2MTkxMRUCABIYFDNBODRBMjRDRDQwNTk3Qzc3ODk1AA==",

"timestamp": "1749886422",

"text": {

"body": "Test"

},

"type": "text"

}

],

"field": "messages"

}

]

yes correct, it is whatsapp business cloud

I wanted to build by work flow to process text prompt only but using ‘edit field (set)’ node.

whatapp cloud trigger
edit field (set) → manual mapping {{ $json.messages[0].text.body }}
ai agent
simple memory → {{ $(‘WhatsApp Trigger’).item.json.contacts[0].wa_id }}
open ai chat model

I’m guessing during my test, when I trigger whatsapp prompt with an image upload, it may have affected simple memory. So when I tried sending text again, it did not work

After adding a session ID setup, it worked. Also tested with triggering:

text → worked
image → did not work
text → worked
But I’m not sure why adding session ID setup worked

Try doing it this way:

{
"sessionId": "{{ $("WhatsApp Trigger").item.json.messages[0].from }}"
}

It needs to be identified as a sessionID

I have this exact same issue using simple memory and using the N8N Workflow execution ID for the key.