{"record":{"id":"82d477f344b2d0e5","repo":"BerriAI/litellm","slug":"query-must-be-a-string-or-list-of-strings-got-ty","errorCode":null,"errorMessage":"query must be a string or list of strings, got {type(query)}","messagePattern":"query must be a string or list of strings, got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/search/main.py","lineNumber":237,"sourceCode":"        )\n\n        # Access results\n        for result in response.results:\n            print(f\"{result.title}: {result.url}\")\n            print(f\"Snippet: {result.snippet}\")\n            if result.date:\n                print(f\"Date: {result.date}\")\n        ```\n    \"\"\"\n    local_vars: Final = locals()\n    try:\n        litellm_logging_obj: Final[LiteLLMLoggingObj] = kwargs.pop(\"litellm_logging_obj\")\n        litellm_call_id: Final[str | None] = kwargs.get(\"litellm_call_id\", None)\n        _is_async: Final = kwargs.pop(\"asearch\", False) is True\n\n        # Validate query parameter\n        if not isinstance(query, (str, list)):\n            raise ValueError(f\"query must be a string or list of strings, got {type(query)}\")\n\n        if isinstance(query, list) and not all(isinstance(q, str) for q in query):\n            raise ValueError(\"All items in query list must be strings\")\n\n        # Get provider config\n        search_provider_config: Final[BaseSearchConfig | None] = ProviderConfigManager.get_provider_search_config(\n            provider=SearchProviders(search_provider),\n        )\n\n        if search_provider_config is None:\n            raise ValueError(f\"Search is not supported for provider: {search_provider}\")\n\n        verbose_logger.debug(\"Search call - provider: %s\", search_provider)\n\n        # Build optional_params from explicit parameters\n        optional_params: Final = _build_search_optional_params(\n            max_results=max_results,\n            search_domain_filter=search_domain_filter,","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/search/main.py#L219-L255","documentation":"Raised by the query-parameter guard at the top of litellm.search: the search API only accepts a query that is a single string or a list of strings. This fires when the caller passes an int, dict, None, or any other type, before any provider request is attempted.","triggerScenarios":"Thrown at litellm/search/main.py:237 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass query as a string or a list of strings."],"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-14T05:17:10.506Z"}