Skip to content

[Bug]: 500 INTERNAL Error with gemini-3.5-flash and GoogleMaps Grounding tool on Vertex AI #2537

@gellezzz

Description

@gellezzz

Description

Using the google-genai (v2.7.0) SDK with Vertex AI, a 500 INTERNAL ServerError is consistently thrown when attempting to use the GoogleMaps() grounding tool specifically with the gemini-3.5-flash and gemini-3.1-flash-lite models.

This was working perfectly fine last week but started failing recently (likely due to a backend update over the weekend / June 1st).

Key observations isolating the backend issue:

  • The exact same code works perfectly with gemini-2.5-flash and gemini-3.1-pro-preview.
  • The code FAILS consistently with gemini-3.5-flash and gemini-3.1-flash-lite.
  • The code works perfectly with these failing models if the GoogleMaps tool is removed.
  • The code works perfectly with these failing models if ONLY the GoogleSearch tool is used.
  • The 500 error persists even if the RetrievalConfig (lat/lng context) is entirely removed from the tool config.

This strongly suggests a broken backend integration specifically between the newer Flash endpoints (gemini-3.5-flash, gemini-3.1-flash-lite) and the Google Maps Grounding service on Vertex AI.
### Environment

  • OS: Linux / Google Cloud Run
  • Python version: 3.12
  • google-genai version: 2.7.0
  • Authentication: Vertex AI (vertexai=True / Enterprise mode) via Application Default Credentials (GOOGLE_APPLICATION_CREDENTIALS).

    Steps to Reproduce

import os
from google import genai
from google.genai import types

# Using ADC / Service account credentials
client = genai.Client(
    vertexai=True,
    project="YOUR_GOOGLE_CLOUD_PROJECT", # Replaced with actual project
    location="global",
    http_options=types.HttpOptions(api_version="v1")
)

prompt = """Give me detailed info abount {\"name\": \"1 Kitchen\", \"address\": \"8490 Sunset Blvd, West Hollywood, CA 90069, USA\"}"""

response = client.models.generate_content(
    # Fails with 'gemini-3.5-flash' and 'gemini-3.1-flash-lite'
    # Works with 'gemini-3.1-pro-preview' and 'gemini-2.5-flash'
    model='gemini-3.5-flash', 
    contents=prompt,
    config=types.GenerateContentConfig(
        tools=[types.Tool(google_maps=types.GoogleMaps())],
        tool_config=types.ToolConfig(retrieval_config=types.RetrievalConfig(
            lat_lng=types.LatLng(latitude=30.2672, longitude=-97.7431)
        )),
    ),
)

print(response.text)

Actual Result / Traceback

The request reaches the server but crashes on Google's side, returning:

  File "/.../site-packages/google/genai/errors.py", line 186, in raise_error
    raise ServerError(status_code, response_json, response)
google.genai.errors.ServerError: 500 INTERNAL. y'error': {'code': 500, 'message': 'Internal server error. Please retry. If the problem persists, please open a support case. https://goo.gle/maps-platform-support', 'status': 'INTERNAL'}}

Expected Result

A successful generation response containing grounding_metadata and grounding_chunks from Google Maps, identical to the correct behavior currently observed when switching the model string to gemini-3.1-pro-preview or gemini-2.5-flash.

Metadata

Metadata

Labels

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
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions