Chat memory with postgre return error after second msg

Describe the problem/error/question

Hello. i have such problem:
standart workflow with chat and chat memory connected to PostgreDB.
So the problem is that after one entry in database it stop chating abd return error.
So i am sending my first message, all goes good i see entry in db


then second message- error
if iam deleting this entry? then i can send one more message, system write this message to db, one more message - error again

What is the error message (if any)?

2024-11-13_18-31-32

Please share your workflow

Error msg

Error: Got unexpected type: undefined at mapStoredMessageToChatMessage (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/messages/utils.cjs:174:19) at Array.map () at mapStoredMessagesToChatMessages (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/messages/utils.cjs:187:21) at PostgresChatMessageHistory.getMessages (/usr/local/lib/node_modules/n8n/node_modules/@langchain/community/dist/stores/message/postgres.cjs:126:63) at processTicksAndRejections (node:internal/process/task_queues:95:5) at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain/dist/nodes/memory/MemoryManager/MemoryManager.node.js:274:30) at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:722:19) at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:707:51 at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1137:20

Information on your n8n setup

  • n8n version: 1,66
  • Database (default: SQLite): def
  • n8n EXECUTIONS_PROCESS setting (default: own, main): def
  • Running n8n via: runing via docker compose
  • Operating system:Ubuntu 22/04

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:

Sorry! problem solved!
The field message in DB must be JSON type, not the text or single line text, you can extract this JSON by JSON_EXTRACT formula in the next field

2 Likes

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