Postgres memory error

Help

Im working rn on a project wich include an ai agent. I use postgres as memory and gemini as ai model (also openai as fallback). Recently ive started to work on looping message so they will be analysed (in ai agent) in order. After Ive finished the work and started to test it, for some reason the postgres started to give the following error: "Bad request - please check your parameter [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-3-flash-preview:generateContent: [400 Bad Request] Please ensure that function response turn comes immediately after a function call turn.". I guess that the problem is that for some reason empty content data being stored in memory. I have no idea how to fix it. The workflow doesnt error every execution, buy its happend frequently.

https://preview.redd.it/5zsawwjv7zch1.png?width=603&format=png&auto=webp&s=f35aac8c40d0bcf6ad1f1e59678862c7a6a460e8

Latest n8n version
Windows 10
Hosted on pikapods

Posted Jul 13, 2026, 10:47 AM UTC

14
Loading comments…