litellm - ✅(Solved) Fix [Bug]: Vertex AI - "Multiple tools are supported only when they are all search tools" when request has both web_search_options and function tools [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#26882Fetched 2026-05-01 05:34:33
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×3cross-referenced ×1

Error Message

litellm.BadRequestError: VertexAIException - 400 {
"error": {
"message": "Multiple tools are supported only when they are all search tools",
"status": "INVALID_ARGUMENT" } }

Root Cause

Root cause: LiteLLM converts the web_search Responses API tool into web_search_options before the Vertex AI mapper runs. The tools parameter
(function declarations) and web_search_options are then mapped independently. _resolve_search_tool_conflict only runs inside _map_function and never sees
the googleSearch Tool added by _map_web_search_options, so the conflict is
never caught

Fix Action

Fixed

PR fix notes

PR #26887: Fix Vertex web search with function tool conflict

Description (problem / solution / changelog)

What changed

Fixes #26882.

Vertex Gemini already drops search tools when _map_function() sees them alongside function declarations, but web_search_options is mapped separately and appended to optional_params["tools"] later. That allowed requests with both function tools and web_search_options to reach Vertex as multiple Tool objects, triggering Multiple tools are supported only when they are all search tools.

This adds a Vertex-specific append guard so search tools are dropped whenever function declarations are present, regardless of whether tools or web_search_options is processed first. The existing include_server_side_tool_invocations escape hatch is preserved for Gemini 3+ tool combination mode.

Tests

  • uv run --extra proxy pytest tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py -q

Changed files

  • litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py (modified, +56/-0)
  • tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py (modified, +139/-8)

Code Example

litellm.BadRequestError: VertexAIException - 400
  {                                               
    "error": {                                                                  
      "message": "Multiple tools are supported only when they are all search
  tools",                                                                       
      "status": "INVALID_ARGUMENT"
    }
  }
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

When using the LiteLLM proxy with Vertex AI (Gemini), sending a request from codex cli that includes both function calling tools and web_search_options causes a 400
error:

"Multiple tools are supported only when they are all search tools"

Root cause: LiteLLM converts the web_search Responses API tool into web_search_options before the Vertex AI mapper runs. The tools parameter
(function declarations) and web_search_options are then mapped independently. _resolve_search_tool_conflict only runs inside _map_function and never sees
the googleSearch Tool added by _map_web_search_options, so the conflict is
never caught

Steps to Reproduce

  1. Send a chat completion request to a Vertex AI Gemini model with both:

    • tools: [{ type: "function", function: { name: "my_func", ... } }]
    • web_search_options: {}
  2. LiteLLM maps tools → function_declarations Tool, web_search_options → googleSearch Tool

  3. Vertex AI returns 400: "Multiple tools are supported only when they are all search tools"

Relevant log output

litellm.BadRequestError: VertexAIException - 400
  {                                               
    "error": {                                                                  
      "message": "Multiple tools are supported only when they are all search
  tools",                                                                       
      "status": "INVALID_ARGUMENT"
    }
  }

What part of LiteLLM is this about?

Proxy

What LiteLLM version are you on ?

v1.83.10

Twitter / LinkedIn details

No response

extent analysis

TL;DR

Modify the LiteLLM proxy to handle the conflict between function calling tools and web_search_options by ensuring _resolve_search_tool_conflict checks for both types of tools.

Guidance

  • Review the _map_function and _map_web_search_options functions to understand how tools are mapped independently, leading to the conflict.
  • Consider modifying the _resolve_search_tool_conflict function to run outside of _map_function to catch conflicts between function declarations and web_search_options.
  • Verify that the Vertex AI mapper is correctly handling the updated tool mappings.
  • Test the modified proxy with a chat completion request that includes both function calling tools and web_search_options to ensure the 400 error is resolved.

Example

No code snippet is provided as the issue does not include sufficient code context.

Notes

The solution may require changes to the LiteLLM proxy code, specifically in the _resolve_search_tool_conflict function. The exact implementation will depend on the internal workings of the LiteLLM proxy.

Recommendation

Apply a workaround by modifying the LiteLLM proxy to handle the tool conflict, as the issue is specific to the proxy's interaction with Vertex AI and there is no clear indication of a fixed version that resolves this issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

litellm - ✅(Solved) Fix [Bug]: Vertex AI - "Multiple tools are supported only when they are all search tools" when request has both web_search_options and function tools [1 pull requests, 1 participants]