Skip to content

Random Errors 429 RESOURCE_EXHAUSTED or Too Many Request #1364

@samuelexferri

Description

@samuelexferri

I'm using the library with the gemini-3.1-pro-preview model in the global location in VertexAI mode (not Gemini API or AI Studio). Over the past month, I've been hitting a lot of 429 RESOURCE_EXHAUSTED errors (this was happening with 3.0-pro as well).

I tried enabling retryOptions to handle the load, but I'm still getting Too Many Requests failures. I've already checked my quotas in the Google Cloud Console, and nothing appears to be exceeding 100%. Has anyone else experienced this with the global endpoint?

      this.client = new GoogleGenAI({
        vertexai: this.useVertex,
        project: googleProjectId,
        location: 'global',
        googleAuthOptions: {
          credentials: JSON.parse(googleKeyFile || '{}')
        },
        //httpOptions: { retryOptions: { attempts: 5 } }
      });


      const result = await this.client.models.generateContent({
        model: 'gemini-3.1-pro-preview',
        contents: geminiHistory,
        config: {
          temperature: 1.0,
          systemInstruction: systemPrompt,
          responseMimeType: 'application/json',
          responseSchema: sanitizeJSONSchema(schema)
        }
      });

Environment details

  • Programming language: JS/TS
  • OS: Ubuntu
  • Language runtime version: NodeJS v24
  • Package version: 1.42.0

Metadata

Metadata

Assignees

Labels

api: vertex-aiIssues related to the Vertex AI API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions