Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Error: [GoogleGenerativeAI Error]: Error fetching from gemini-2.0-flash:generateContent: [400 Bad Request] #731

@mrroccodev

Description

@mrroccodev

[REQUIRED] Step 2: Describe your configuration

  • Extension name: firestore-genai-chatbot
  • Extension version: 0.0.14
  • Configuration values (redact info where appropriate):
    • gemini-2.0-flash
    • us-east1

[REQUIRED] Step 3: Describe the problem

The problem Is that I got only 25% of the results from my users return this error. It seems that some times of the hour the model is not available to give responses. I tried diferente server zones, but I keep this rate of 25% of errors.

Image

If I use Google AI as a provider the error is:
Error: [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent: [400 Bad Request]
at handleResponseNotOk (/workspace/node_modules/@genkit-ai/googleai/node_modules/@google/generative-ai/dist/index.js:434:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async makeRequest (/workspace/node_modules/@genkit-ai/googleai/node_modules/@google/generative-ai/dist/index.js:403:9)
at async generateContent (/workspace/node_modules/@genkit-ai/googleai/node_modules/@google/generative-ai/dist/index.js:867:22)
at async ChatSession.sendMessage (/workspace/node_modules/@genkit-ai/googleai/node_modules/@google/generative-ai/dist/index.js:1205:9)
at async callGemini (/workspace/node_modules/@genkit-ai/googleai/lib/gemini.js:833:26)
at async /workspace/node_modules/@genkit-ai/googleai/lib/gemini.js:878:11
at async /workspace/node_modules/@genkit-ai/core/lib/action.js:210:14
at async /workspace/node_modules/@genkit-ai/core/lib/action.js:131:27
at async /workspace/node_modules/@genkit-ai/core/lib/tracing/instrumentation.js:65:16

If I use VertexAI as the provider I got the error:
SyntaxError: Unexpected token '<', ")
at parseJSONFromBytes (node:internal/deps/undici/undici:5738:19)
at successSteps (node:internal/deps/undici/undici:5719:27)
at fullyReadBody (node:internal/deps/undici/undici:4609:9)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async consumeBody (node:internal/deps/undici/undici:5728:7)
at async throwErrorIfNotOK (/workspace/node_modules/@google-cloud/vertexai/build/src/functions/post_fetch_processing.js:29:27)
at async generateContent (/workspace/node_modules/@google-cloud/vertexai/build/src/functions/generate_content.js:58:5)
at async ChatSessionPreview.sendMessage (/workspace/node_modules/@google-cloud/vertexai/build/src/models/chat_session.js:242:39)
at async callGemini (/workspace/node_modules/@genkit-ai/vertexai/lib/gemini.js:905:26)

Metadata

Metadata

Assignees

Labels

blockedBlocked by an outstanding issue or PRtype: bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions