I’ve created this simple workflow in n8n that retrieves unread emails via the Gmail node and sends them to the AI Agent node using Google Gemini as a free alternative to OpenAI.
However, when the Gmail node is connected to the AI Agent node, I encounter the following error:
UPDATE
I saw that in my case, if in FSh tools module is sending more information than, chatInput, sessionId,action - for example
It works like this.
[
{
{ “chatInput”: “hello”,
“sessionId": ‘342318385’,
{ “action”: “sendMessage”
}
]
But if there are more other parameters in the json, the AI module on 1.68.0 waits a few minutes and gives an unrelated error, on 1.74.1 it gives the above error immediately.
I assume that the node takes the whole array from the previous node, which in principle is good for adding special instructions to Gemini, but Gemini does not expect to see them and react to them.
Workaround
And one of my solutions was to reduce the number of nodes in the chain up to AI assistant, thus AI agent went to a separate workflow with parameters, first node is execute workflow trigger (like chat), second is AI agent, and everything worked. It wasn’t logical, but it works.
Hi @Shima
I was getting the same issue of adding “Human: ” automatically and because of this, was getting the same error:
Bad request - please check your parameters
[GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-001:streamGenerateContent?alt=sse: [400 Bad Request] * GenerateContentRequest.contents[1].parts: contents.parts must not be empty.
Solution: Add a ‘edit fields’ node before the AI agent and fetch out the necessary keys in the ‘edit fields’ node only and then pass it to AI agent.
This worked in my case, u can also give it a try.