Disclosure: I'm Mohammed, founder of MemorySync. I drafted this page with AI assistance and checked it against the source issue and the MemorySync n8n guide. I didn't run any code on this page.
The question
In n8n-io/n8n#33161 , a self-hosted user (n8n 2.27.4) runs an AI Agent with Anthropic as the main model and Google Gemini as the fallback. When Gemini answers, the reply is stored in the Postgres Chat Memory table with type: "user" instead of type: "ai" . On the next message in that session, LangChain's mapStoredMessageToChatMessage throws Got unexpected type: user and the agent fails.
Status (checked 2026-10-28 via the GitHub API): open, 2 visible comments, last updated Jul 8, 2026. n8n's bot logged it internally (GHC-8825). One community comment suggests fixing it at the serialization boundary in n8n's Postgres Chat Memory node, before the message is written. No fix is linked in the issue yet.
What you can do now
These are workarounds, not an official fix.…