Postgres/Supabase Database Error: Cannot read properties of undefined (reading 'map')

Error [ERROR: Cannot read properties of undefined (reading 'filter')] with chat and ai agent - This thread has been closed, but it’s definitely not been resolved.

I have exactly the same issue when using the Postgres Chat Memory node connected to Supabase. If I delete all the data in the database, it works. If I then try to use it any time after the first chat, it shows an error which is pretty useless for a chat use case.

{
“errorMessage”: “Cannot read properties of undefined (reading ‘map’)”,
“errorDetails”: {},
“n8nDetails”: {
“n8nVersion”: “1.59.4 (Self Hosted)”,
“binaryDataMode”: “default”,
“stackTrace”: [
“TypeError: Cannot read properties of undefined (reading ‘map’)”,
" at _formatContent (/usr/local/lib/node_modules/n8n/node_modules/@langchain/anthropic/dist/utils/message_inputs.cjs:105:39)“,
" at /usr/local/lib/node_modules/n8n/node_modules/@langchain/anthropic/dist/utils/message_inputs.cjs:224:26”,
" at Array.map ()“,
" at _formatMessagesForAnthropic (/usr/local/lib/node_modules/n8n/node_modules/@langchain/anthropic/dist/utils/message_inputs.cjs:172:52)”,
" at ChatAnthropic._streamResponseChunks (/usr/local/lib/node_modules/n8n/node_modules/@langchain/anthropic/dist/chat_models.cjs:671:87)“,
" at _streamResponseChunks.next ()”,
" at ChatAnthropic._streamIterator (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/language_models/chat_models.cjs:92:34)“,
" at processTicksAndRejections (node:internal/process/task_queues:95:5)”,
" at ChatAnthropic.transform (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:402:9)“,
" at RunnableBinding.transform (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:846:9)”,
" at ToolCallingAgentOutputParser.transform (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:391:26)“,
" at RunnableSequence._streamIterator (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:1219:30)”,
" at RunnableSequence.transform (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:402:9)“,
" at wrapInputForTracing (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:275:30)”,
" at pipeGeneratorWithSetup (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/utils/stream.cjs:260:19)“,
" at RunnableLambda._transformStreamWithConfig (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:296:26)”,
" at RunnableSequence._streamIterator (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:1219:30)"
]
}
}

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:

Hi @elliott,

Could you share your workflow with us so we can have a look at how you’ve configured your workflow and the nodes? Also, which version of n8n are you on?

Tip for sharing your workflow in the forum

Pasting your n8n workflow


Ensure to copy your n8n workflow and paste it in the code block, that is in between the pairs of triple backticks, which also could be achieved by clicking </> (preformatted text) in the editor and pasting in your workflow.

```
<your workflow>
```

Make sure that you’ve removed any sensitive information from your workflow and include dummy data or pinned data as much as you can!


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