Error in sub-node ‘Redis Chat Memory‘

Guys, for some reason, when I use any tools in my AI agent, the memory is returning the remoteJid value as undefined, and I get this error on the screen.

If I tell my agent that it doesn’t need to use the tools, the memory returns the key value normally, but when using the tools, the memory returns the key as undefined.

This error occurs when using Redis and the default n8n memory.

Try “first” instead “item” at variable call…

Yeah so in your session key expression, switch .item to .first() — like {{ $('Webhook').first().json.body.data.remoteJid }}. Sub-nodes re-evaluate expressions when tools run and .item loses context during that, .first() always resolves correctly.