litellm - ✅(Solved) Fix [Bug]: Vertex AI Gemini 2.5 Flash/Pro - "Multiple tools are supported only when they are all search tools" still occurs with v1.83.10-stable+ [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#26682Fetched 2026-04-29 06:12:54
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
labeled ×3cross-referenced ×1

Error Message

curl -sS
-X POST "$LITELLM_BASE_URL/v1/chat/completions"
-H "Authorization: Bearer $LITELLM_API_KEY"
-H "Content-Type: application/json"
-d '{ "model": "gemini-2.5-pro", "messages": [ { "role": "user", "content": "Who won the Hungarian election in 2026?" } ], "tools": [ { "type": "function", "function": { "name": "notion_search", "description": "Search Notion", "parameters": {"type": "object", "properties": {"query": {"type": "string"}}} } } ] }' | jq .

{ "error": { "message": "litellm.BadRequestError: Vertex_aiException BadRequestError - {\n "error": {\n "code": 400,\n "message": "Multiple tools are supported only when they are all search tools.",\n "status": "INVALID_ARGUMENT"\n }\n}\n. Received Model Group=gemini-2.5-pro\nAvailable Model Group Fallbacks=None",
"type": null, "param": null, "code": "400" }

Fix Action

Fixed

PR fix notes

PR #26688: fix(vertex): drop mixed search tools with functions

Description (problem / solution / changelog)

Vertex AI could keep a pre-existing googleSearch tool when web_search_options was added before function tools, which triggers Gemini's multi-tool validation error. I added a final cleanup pass so search tools are removed whenever function declarations are present, regardless of parameter order, while preserving server-side tool invocations. Added a regression test for the web_search_options-first order and verified the Gemini vertex test suite passes. Fixes #26682.

Changed files

  • .circleci/config.yml (modified, +3/-3)
  • .github/pull_request_template.md (modified, +4/-0)
  • .npmrc (modified, +1/-1)
  • docs/my-website/docs/proxy/guardrails/xecguard.md (added, +314/-0)
  • litellm-js/proxy/.npmrc (modified, +1/-1)
  • litellm-js/spend-logs/.npmrc (modified, +1/-1)
  • litellm/_redis_credential_provider.py (modified, +57/-7)
  • litellm/constants.py (modified, +10/-0)
  • litellm/exceptions.py (modified, +30/-1)
  • litellm/integrations/custom_guardrail.py (modified, +1/-37)
  • litellm/litellm_core_utils/prompt_templates/factory.py (modified, +22/-13)
  • litellm/llms/bedrock/chat/converse_transformation.py (modified, +2/-2)
  • litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py (modified, +7/-1)
  • litellm/llms/ollama/chat/transformation.py (modified, +7/-2)
  • litellm/llms/predibase/chat/handler.py (modified, +43/-228)
  • litellm/llms/predibase/chat/transformation.py (modified, +212/-7)
  • litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py (modified, +32/-0)
  • litellm/model_prices_and_context_window_backup.json (modified, +32/-32)
  • litellm/proxy/common_utils/expired_ui_session_key_cleanup_manager.py (added, +156/-0)
  • litellm/proxy/guardrails/guardrail_hooks/noma/noma_v2.py (modified, +1/-2)
  • litellm/proxy/guardrails/guardrail_hooks/unified_guardrail/unified_guardrail.py (modified, +10/-0)
  • litellm/proxy/guardrails/guardrail_hooks/xecguard/__init__.py (added, +45/-0)
  • litellm/proxy/guardrails/guardrail_hooks/xecguard/xecguard.py (added, +585/-0)
  • litellm/proxy/pass_through_endpoints/pass_through_endpoints.py (modified, +73/-5)
  • litellm/proxy/proxy_cli.py (modified, +33/-0)
  • litellm/proxy/proxy_server.py (modified, +81/-2)
  • litellm/router.py (modified, +4/-2)
  • litellm/types/guardrails.py (modified, +5/-0)
  • litellm/types/llms/ollama.py (modified, +1/-0)
  • litellm/types/proxy/guardrails/guardrail_hooks/xecguard.py (added, +77/-0)
  • model_prices_and_context_window.json (modified, +32/-32)
  • tests/proxy_admin_ui_tests/.npmrc (modified, +1/-1)
  • tests/proxy_admin_ui_tests/ui_unit_tests/.npmrc (modified, +1/-1)
  • tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py (modified, +10/-10)
  • tests/test_litellm/litellm_core_utils/prompt_templates/test_litellm_core_utils_prompt_templates_factory.py (modified, +109/-0)
  • tests/test_litellm/llms/bedrock/messages/invoke_transformations/test_anthropic_claude3_transformation.py (modified, +80/-0)
  • tests/test_litellm/llms/ollama/test_ollama_chat_transformation.py (modified, +95/-0)
  • tests/test_litellm/llms/test_predibase_transformation.py (added, +612/-0)
  • tests/test_litellm/llms/vertex_ai/gemini/test_vertex_web_search_tool_order.py (added, +35/-0)
  • tests/test_litellm/proxy/common_utils/test_expired_ui_session_key_cleanup_manager.py (added, +348/-0)
  • tests/test_litellm/proxy/guardrails/guardrail_hooks/test_noma_v2.py (modified, +38/-0)
  • tests/test_litellm/proxy/guardrails/guardrail_hooks/test_xecguard.py (added, +1904/-0)
  • tests/test_litellm/proxy/pass_through_endpoints/test_passthrough_post_call_guardrails.py (added, +276/-0)
  • tests/test_litellm/proxy/test_proxy_cli.py (modified, +65/-0)
  • tests/test_litellm/test_redis.py (modified, +76/-9)
  • tests/test_litellm/test_router.py (modified, +63/-0)
  • ui/litellm-dashboard/.npmrc (modified, +1/-1)
  • ui/litellm-dashboard/public/assets/logos/xecguard.svg (added, +4/-0)
  • ui/litellm-dashboard/src/app/(dashboard)/hooks/proxyConfig/useProxyConfig.test.ts (modified, +23/-0)
  • ui/litellm-dashboard/src/app/(dashboard)/hooks/proxyConfig/useProxyConfig.ts (modified, +6/-2)
  • ui/litellm-dashboard/src/app/(dashboard)/hooks/storeRequestInSpendLogs/useStoreRequestInSpendLogs.ts (modified, +6/-1)
  • ui/litellm-dashboard/src/components/AdminPanel.tsx (modified, +6/-0)
  • ui/litellm-dashboard/src/components/Settings/AdminSettings/LoggingSettings/LoggingSettings.test.tsx (added, +335/-0)
  • ui/litellm-dashboard/src/components/Settings/AdminSettings/LoggingSettings/LoggingSettings.tsx (added, +145/-0)
  • ui/litellm-dashboard/src/components/guardrails/guardrail_garden_configs.ts (modified, +6/-0)
  • ui/litellm-dashboard/src/components/guardrails/guardrail_garden_data.ts (modified, +10/-0)
  • ui/litellm-dashboard/src/components/guardrails/guardrail_info_helpers.tsx (modified, +2/-0)
  • ui/litellm-dashboard/src/components/mcp_tools/mcp_server_edit.test.tsx (modified, +1/-1)
  • ui/litellm-dashboard/src/components/mcp_tools/mcp_server_edit.tsx (modified, +15/-31)
  • ui/litellm-dashboard/src/components/view_logs/ConfigInfoMessage.test.tsx (modified, +3/-19)
  • ui/litellm-dashboard/src/components/view_logs/ConfigInfoMessage.tsx (modified, +3/-14)
  • ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.test.tsx (modified, +0/-21)
  • ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.tsx (modified, +2/-3)
  • ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailsDrawer.tsx (modified, +0/-3)
  • ui/litellm-dashboard/src/components/view_logs/SpendLogsSettingsModal/SpendLogsSettingsModal.test.tsx (removed, +0/-484)
  • ui/litellm-dashboard/src/components/view_logs/SpendLogsSettingsModal/SpendLogsSettingsModal.tsx (removed, +0/-156)
  • ui/litellm-dashboard/src/components/view_logs/index.tsx (modified, +3/-16)

Code Example

model_list:
  - model_name: "gemini-2.5-pro"
    litellm_params:
      model: "vertex_ai/gemini-2.5-pro"
      vertex_location: "europe-west4" 
      web_search_options: {}

---

curl -sS \
  -X POST "$LITELLM_BASE_URL/v1/chat/completions" \
  -H "Authorization: Bearer $LITELLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-2.5-pro",
    "messages": [
      {
        "role": "user",
        "content": "Who won the Hungarian election in 2026?"
      }
    ],
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "notion_search",
                "description": "Search Notion",
                "parameters": {"type": "object", "properties": {"query": {"type": "string"}}}
            }
        }
    ]
  }' | jq .


{
  "error": {
    "message": "litellm.BadRequestError: Vertex_aiException BadRequestError - {\n  \"error\": {\n    \"code\": 400,\n    \"message\": \"Multiple tools are supported only when they are all search tools.\",\n    \"status\": \"INVALID_ARGUMENT\"\n  }\n}\n. Received Model Group=gemini-2.5-pro\nAvailable Model Group Fallbacks=None",                                               
    "type": null,
    "param": null,
    "code": "400"
  }

---
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?

The issue which was reported in #23337 and suppose to be fixed in https://github.com/BerriAI/litellm/commit/212b249e38e407bf9103e6c7de6690f7dcfa1207 still occurs in v1.83.10-stable.

Steps to Reproduce

model_list:
  - model_name: "gemini-2.5-pro"
    litellm_params:
      model: "vertex_ai/gemini-2.5-pro"
      vertex_location: "europe-west4" 
      web_search_options: {}
curl -sS \
  -X POST "$LITELLM_BASE_URL/v1/chat/completions" \
  -H "Authorization: Bearer $LITELLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-2.5-pro",
    "messages": [
      {
        "role": "user",
        "content": "Who won the Hungarian election in 2026?"
      }
    ],
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "notion_search",
                "description": "Search Notion",
                "parameters": {"type": "object", "properties": {"query": {"type": "string"}}}
            }
        }
    ]
  }' | jq .


{
  "error": {
    "message": "litellm.BadRequestError: Vertex_aiException BadRequestError - {\n  \"error\": {\n    \"code\": 400,\n    \"message\": \"Multiple tools are supported only when they are all search tools.\",\n    \"status\": \"INVALID_ARGUMENT\"\n  }\n}\n. Received Model Group=gemini-2.5-pro\nAvailable Model Group Fallbacks=None",                                               
    "type": null,
    "param": null,
    "code": "400"
  }

Relevant log output

What part of LiteLLM is this about?

Proxy

What LiteLLM version are you on ?

v1.83.10-stable

Twitter / LinkedIn details

No response

extent analysis

TL;DR

The issue can be resolved by ensuring that all tools in the request are search tools when using multiple tools with the "gemini-2.5-pro" model.

Guidance

  • Verify that the error message "Multiple tools are supported only when they are all search tools" is related to the tools specified in the request, specifically the "notion_search" function.
  • Check the documentation for the "gemini-2.5-pro" model to confirm its support for multiple tools and the requirements for those tools.
  • Consider removing or modifying the non-search tool ("notion_search" function) from the request to test if the issue is resolved.
  • If the issue persists, review the LiteLLM version (v1.83.10-stable) and check for any known issues or updates related to tool support.

Example

No code snippet is provided as the issue is related to the configuration and usage of the LiteLLM model and tools.

Notes

The issue may be specific to the "gemini-2.5-pro" model or the LiteLLM version being used. Further investigation into the model's documentation and known issues may be necessary to resolve the problem.

Recommendation

Apply workaround: Remove or modify non-search tools from the request to test if the issue is resolved, as the error message suggests that multiple tools are only supported when they are all search tools.

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 Gemini 2.5 Flash/Pro - "Multiple tools are supported only when they are all search tools" still occurs with v1.83.10-stable+ [1 pull requests, 1 participants]