{"record":{"id":"b0fbfff95ed97ed6","repo":"BerriAI/litellm","slug":"searxng-api-base-is-not-set-please-set-the-searx","errorCode":null,"errorMessage":"SEARXNG_API_BASE is not set. Please set the `SEARXNG_API_BASE` environment variable or pass `api_base` parameter. Example: os.environ['SEARXNG_API_BASE'] = 'https://your-searxng-instance.com'","messagePattern":"SEARXNG_API_BASE is not set\\. Please set the `SEARXNG_API_BASE` environment variable or pass `api_base` parameter\\. Example: os\\.environ\\['SEARXNG_API_BASE'\\] = 'https://your-searxng-instance\\.com'","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/searxng/search/transformation.py","lineNumber":94,"sourceCode":"    def get_complete_url(\n        self,\n        api_base: str | None,\n        optional_params: dict,\n        data: dict | list[dict] | None = None,\n        **kwargs,\n    ) -> str:\n        \"\"\"\n        Get complete URL for Search endpoint with query parameters.\n\n        SearXNG uses GET requests, so we build the full URL with query params here.\n        The transformed request body (data) contains the parameters needed for the URL.\n        \"\"\"\n        from urllib.parse import urlencode\n\n        api_base = api_base or get_secret_str(\"SEARXNG_API_BASE\")\n\n        if not api_base:\n            raise ValueError(\n                \"SEARXNG_API_BASE is not set. Please set the `SEARXNG_API_BASE` environment variable \"\n                \"or pass `api_base` parameter. Example: os.environ['SEARXNG_API_BASE'] = 'https://your-searxng-instance.com'\"\n            )\n\n        # Append \"/search\" to the api base if it's not already there\n        if not api_base.endswith(\"/search\"):\n            if api_base.endswith(\"/\"):\n                api_base = f\"{api_base}search\"\n            else:\n                api_base = f\"{api_base}/search\"\n\n        # Build query parameters from the transformed request body\n        if data and isinstance(data, dict) and \"_searxng_params\" in data:\n            params: Final = data[\"_searxng_params\"]\n            query_string: Final = urlencode(params)\n            return f\"{api_base}?{query_string}\"\n\n        return api_base","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/searxng/search/transformation.py#L76-L112","documentation":"Error \"SEARXNG_API_BASE is not set. Please set the `SEARXNG_API_BASE` environment variable or pass `api_base` parameter. Example: os.environ['SEARXNG_API_BASE'] = 'https://your-searxng-instance.com'\" thrown in BerriAI/litellm.","triggerScenarios":"Triggered when calling SearXNG search without SEARXNG_API_BASE set or api_base passed.","commonSituations":"See trigger scenarios.","solutions":["Set SEARXNG_API_BASE to your SearXNG instance URL.","Or pass api_base parameter to the search call."],"exampleFix":"os.environ['SEARXNG_API_BASE'] = 'https://your-searxng-instance.com'","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"}