BerriAI/litellm · error · ValueError

search_tool_name or model parameter is required for search

Error message

search_tool_name or model parameter is required for search

What it means

Argument guard in the router's asearch wrapper: neither search_tool_name nor model was present in kwargs, so the router cannot tell which configured search tool to route through.

Source

Thrown at litellm/router_utils/search_api_router.py:132

        **kwargs,
    ):
        """
        Helper function to make a search API call through the router with load balancing and fallbacks.
        Reuses the router's retry/fallback infrastructure.

        Args:
            router_instance: The Router instance
            original_function: The original litellm.asearch function
            **kwargs: Search parameters including search_tool_name, query, etc.

        Returns:
            SearchResponse from the search API
        """
        try:
            search_tool_name: Final = kwargs.get("search_tool_name", kwargs.get("model"))

            if not search_tool_name:
                raise ValueError("search_tool_name or model parameter is required for search")

            # Set up kwargs for the fallback system
            kwargs["model"] = search_tool_name  # Use model field for compatibility with fallback system
            kwargs["original_generic_function"] = original_function
            # Bind router_instance to the helper method using partial
            kwargs["original_function"] = partial(
                SearchAPIRouter.async_search_with_fallbacks_helper,
                router_instance=router_instance,
            )

            # Update kwargs before fallbacks (for logging, metadata, etc)
            router_instance._update_kwargs_before_fallbacks(
                model=search_tool_name,
                kwargs=kwargs,
                metadata_variable_name="litellm_metadata",
            )

            available_search_tool_names: Final = [tool.get("search_tool_name") for tool in router_instance.search_tools]

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Pass search_tool_name or model in the search request.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/router_utils/search_api_router.py:132 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/e31f54449e6eab18. Report an issue: GitHub.