AI Agent - chat history error on using sessionId from previous node

Describe the problem/error/question

Issue in a workflow with AI agent and agent memory.
What am I doing wrong?

What is the error message (if any)?

connect “Postgres Chat Memory” to “set_params” (same happens with simple memory)

Please share your workflow

Share the output returned by the last node


Information on your n8n setup

  • n8n version: 1.9.2
  • Database (default: SQLite): postgresql
  • n8n EXECUTIONS_PROCESS setting (default: own, main): queue
  • Running n8n via (Docker, npm, n8n cloud, desktop app): kubernetes → docker
  • Operating system:

Hi @ypyly

I was able to replicate the error and found that you’re using an old legacy expression syntax: $node["Node Name"]

Please switch to the current standard syntax $("<node-name>").item which is working as expected:

So in your case, for the Postgres Chat Memory key, try updating your syntax to:

{{ $('set_params').item.json.sessionId }}

Also, since other nodes in your workflow are still using the legacy syntax, I recommend updating those as well to avoid similar errors in the future.



If you find this helpful, kindly mark the reply as the solution :white_check_mark::pray:t2:

2 Likes

oh wow, I didn’t knew that I’ve been using an old legacy expression :slight_smile:
Thanks for mentioning it. Works as expected.
P.S> yeah, went over all of my workflows removing usage obsolete way of referring nodes.

1 Like

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