{"record":{"id":"607361b40e933078","repo":"BerriAI/litellm","slug":"got-an-unexpected-none-response-from-the-search-ap","errorCode":null,"errorMessage":"Got an unexpected None response from the Search API: {response}","messagePattern":"Got an unexpected None response from the Search API: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/search/main.py","lineNumber":148,"sourceCode":"            country=country,\n            api_key=api_key,\n            api_base=api_base,\n            timeout=timeout,\n            extra_headers=extra_headers,\n            **kwargs,\n        )\n\n        ctx: Final = contextvars.copy_context()\n        func_with_context: Final = partial(ctx.run, func)\n        init_response: Final = await loop.run_in_executor(None, func_with_context)\n\n        if asyncio.iscoroutine(init_response):\n            response = await init_response\n        else:\n            response = init_response\n\n        if response is None:\n            raise ValueError(f\"Got an unexpected None response from the Search API: {response}\")\n\n        return response\n    except Exception as e:\n        model_name: Final = f\"{search_provider}/search\"\n        raise litellm.exception_type(\n            model=model_name,\n            custom_llm_provider=search_provider,\n            original_exception=e,\n            completion_kwargs=local_vars,\n            extra_kwargs=kwargs,\n        )\n\n\n@client\ndef search(\n    query: str | list[str],\n    search_provider: str,\n    max_results: int | None = None,","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/search/main.py#L130-L166","documentation":"Result guard in the search API: the provider-specific search call completed but returned None instead of a SearchResponse (provider adapter bug or empty upstream payload); the raw response is included for debugging.","triggerScenarios":"Thrown at litellm/search/main.py:148 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the search; if persistent, check provider credentials and litellm debug logs for why None was returned."],"exampleFix":null,"handlingStrategy":"try-catch","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"}