Gemini-3.6-flash returns HTTP 200 with no final text or returns TOO_MANY_TOOL_CALLS for complex Google Search + URL Context requests

Environment

  • Python 3.12
  • google-genai==2.14.0
  • Gemini Developer API, v1beta
  • Model: gemini-3.6-flash
  • Method: client.models.generate_content()

Summary

Complex generateContent requests combining google_search and url_context can terminate without a final model text response. The HTTP request succeeds with status 200, but the response either reports TOO_MANY_TOOL_CALLS or contains no candidates and no finish reason.

Request configuration

config = types.GenerateContentConfig(
    tools=[
        types.Tool(google_search=types.GoogleSearch()),
        types.Tool(url_context=types.UrlContext()),
    ],
    tool_config=types.ToolConfig(
        include_server_side_tool_invocations=True,
    ),
    thinking_config=types.ThinkingConfig(
        thinking_level="medium",
    ),
    automatic_function_calling=types.AutomaticFunctionCallingConfig(
        disable=True,
    ),
    response_mime_type="application/json",
    max_output_tokens=16384,
)

The request does not include temperature, top_p, top_k, thinking_budget, candidate_count, or custom function declarations.

Actual behavior

The API returns HTTP 200, followed by one of these response shapes:

  1. A candidate ending with TOO_MANY_TOOL_CALLS and no final text part.
  2. No candidates, no finish reason, and response.text is None.

The SDK may also emit:

UserWarning: TOO_MANY_TOOL_CALLS is not a valid FinishReason

Expected behavior

The model should stop invoking built-in tools within the service limit and return a final text response, or the API should return a structured non-200 error explaining that the tool-call limit was exceeded.

The SDK should recognize and expose TOO_MANY_TOOL_CALLS as a valid finish reason without issuing an unknown-enum warning.

Additional observations

  • Search-only requests succeed with gemini-3.6-flash.
  • Small requests combining Search and URL Context also succeed.
  • The failure occurs consistently with longer research prompts, several supplied URLs, and structured JSON output.
  • The equivalent complex request completes successfully with gemini-3-flash-preview, including both Search and URL Context grounding.
  • Prompt instructions limiting the number of searches and requesting immediate final output do not prevent the 3.6 failure.