AI Agent Error with Gemini Model Tools

Describe the problem/error/question

Hi!

I’ve got this error when trying to use the Gemini Chat Model with tools in the AI Agent:

Bad request - please check your parameters

[GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-pro:streamGenerateContent?alt=sse: [400 Bad Request] * GenerateContentRequest.tools[0].function_declarations[0].parameters.properties: should be non-empty for OBJECT type

It only occurrs when using Gemini models (with OpenAI model it doesn’t occurrs)

  • n8n version: 1.71.3
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): Own
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu
1 Like

Hey @Allan_Montero,

I ran into the same issue with Gemini models—first request works fine, but the second fails. Seems like v1beta is a bit unstable.

I also got a 404 Not Found error when trying to use text-bison-001 with v1beta. Looks like some models aren’t supported for generateContent. You might want to call ListModels to check what’s actually available.

A few things to try:
:white_check_mark: Check API Credentials – Make sure they’re valid in n8n.
:white_check_mark: Try a Different Model – Some versions seem more reliable than others.

Switching models and switching back worked for me as a quick fix. Let me know if you figure out a better solution! :rocket:

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