AI Agent Memory Tool problem (Win Buffer and Postgres)

##Hi guys, I’ve been encountering an issue for a couple of days. To give some context, I’m self-hosted, and I use Ngrok for my Webhook integration.

This is my workflow:

After several attempts, I can confirm that the issue lies with the session ID key in the memory tool. I’ve tried it with both Windows and PostgreSQL. I’m using this variable as the session ID key, is a phone number.:
{{ $(‘Webhook’).item.json.body.from }}

The first interaction works fine, but after that, I get an error:
Issues: * Bad request - please check your parameters (Invalid value for ‘content’: expected a string, got null.)

However, if I use this for the session ID key then, no error occurs.:
{{ $(‘Webhook’).item.json.body.from + ’ ’ + new Date().toISOString() }}

The problem with this approach is that it doesn’t remember anything, and the AI agent can’t perform its tasks properly.

  • **Running n8n via Docker
  • **Operating system: Windows

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:

Can you check if the session ID is actually arriving in every request, please?

If yes, then try to use {{ $('Webhook').item.json.body.from.toString() }} instead and see if that works.

If my reply answers your question, please remember to mark it as a solution.

I can confirm that it is happening on my end as well. In my case, it involves the Slack User ID, and it always fails on the second attempt.

I noticed that as long as the key exists in Redis (in my case), it will always fail.
If I replace the session ID with “client_msg_id,” which always changes, it will work; however, in that case, the chat memory won’t remember the previous messages per user.

That’s strange; copying all the settings to a new workload resolved the issue.

I have the same problem as well.
For me it’s with a Simple Memory Node and a web-hook of a Google Chat App.
Either if I use an existing session ID, one that always changes ;
The chat memory won’t remember anything.

Copying didn’t do anything for me.

I guess it’s due to that:

Not gonna lie it’s rather annoying, it makes my workflow, my Agent AI totally useless… :confused:

Hi, Well its kind of normal I guess :slight_smile: I don’t expect to take a lada to a race-track and become first. Similar for simple memory. its just to test and play around.

I can get that but it seems that all Memory options that are available result in the same error.
I’ve tested Simple Memory, Zep Memory, @kruvi used a Redis Memory…

Even tho it’s a recent issue, technology, I would expect a fix from the dev team or at least a work around.

I’m not sure yet what causes this issue, sometimes it happens and sometimes it does not.

But it seems that the agent saves the first user message with null content, when it retrieves it the error happens. At least here in my DB the data that the agent saves is missing a lot of properties inside the json, it saves this: {
“type”: “human”
}

So it has no “content” property then the agent will get null and that breaks the memory and the workflow.

In general the AI agents have been acting weird lately, this problem happens mostly with chatgpt, I’m also struggling with input schema for tools.

Edit: I simply can not explain but I’ve tested before and did not work and now it does, the solution was “.toJsonString()” after adding it to my messages array, it’s working, at least for now.

Hi @arthurlongue i have this same problem, but in my case, I was using a Basic LLM Chain node before an AI Agent node and the latter expects it to contain a “content” property inside the object. And my Basic LLM Chain was sending a “text”. Here’s what I did:

  1. Enable Require Specific Output Format for my Basic LLM Chain node
  2. Define a Structured Output Parser node for this Basic LLM Chain node
  3. Finally add this user prompt to my AI Agent node that comes after my Basic LLM Chain node

Cheers!!

I have the same problem. The first time it runs, it works perfectly, but the second time it reads the memory and finds information, the prompt fails, stating that (Invalid value for ‘content’: expected a string, got null.)

I haven’t been able to get it to work. If anyone already has a solution, please share it.

@Diego_Armando_Galind Have you been able to resolve the issue?

No, the issue continue.

@Diego_Armando_Galind did you try out what @viniciusgomes suggested?

Anyone solved the issue yet? The AI Agent Node is basically useless as a chatbot in this state.
@Diego_Armando_Galind @pingxtra

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