{"record":{"id":"ac178db580e8ee23","repo":"BerriAI/litellm","slug":"search-provider-is-required-in-litellm-params","errorCode":null,"errorMessage":"search_provider is required in litellm_params","messagePattern":"search_provider is required in litellm_params","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/search_endpoints/search_tool_management.py","lineNumber":590,"sourceCode":"    ```json\n    {\n        \"status\": \"error\",\n        \"message\": \"Authentication failed: Invalid API key\",\n        \"error_type\": \"AuthenticationError\"\n    }\n    ```\n    \"\"\"\n    try:\n        from litellm.search import asearch\n\n        # Extract params from request\n        litellm_params: Final = request.litellm_params\n        search_provider: Final = litellm_params.get(\"search_provider\")\n        api_key: Final = litellm_params.get(\"api_key\")\n        api_base: Final = litellm_params.get(\"api_base\")\n\n        if not search_provider:\n            raise HTTPException(status_code=400, detail=\"search_provider is required in litellm_params\")\n\n        verbose_proxy_logger.debug(\"Testing connection to search provider: %s\", search_provider)\n\n        # Make a simple test search query with max_results=1 to minimize cost\n        test_query: Final = \"test\"\n        response: Final = await asearch(\n            query=test_query,\n            search_provider=search_provider,\n            api_key=api_key,\n            api_base=api_base,\n            max_results=1,  # Minimize results to reduce cost\n            timeout=10.0,  # 10 second timeout for test\n        )\n\n        verbose_proxy_logger.debug(\"Successfully tested connection to %s search provider\", search_provider)\n\n        return {\n            \"status\": \"success\",","sourceCodeStart":572,"sourceCodeEnd":608,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/search_endpoints/search_tool_management.py#L572-L608","documentation":"Search invocation validation: the request's litellm_params contain no 'search_provider', so the handler cannot determine which search backend to call; rejected with 400 before the litellm.asearch call is made.","triggerScenarios":"Thrown at litellm/proxy/search_endpoints/search_tool_management.py:590 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Include search_provider in litellm_params of the search tool configuration (e.g. tavily, perplexity)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}