{"record":{"id":"c81f08b121db63f5","repo":"stanford-oval/storm","slug":"you-must-supply-searxng-api-url","errorCode":null,"errorMessage":"You must supply searxng_api_url","messagePattern":"You must supply searxng_api_url","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"knowledge_storm/rm.py","lineNumber":664,"sourceCode":"        self,\n        searxng_api_url,\n        searxng_api_key=None,\n        k=3,\n        is_valid_source: Callable = None,\n    ):\n        \"\"\"Initialize the SearXNG search retriever.\n        Please set up SearXNG according to https://docs.searxng.org/index.html.\n\n        Args:\n            searxng_api_url (str): The URL of the SearXNG API. Consult SearXNG documentation for details.\n            searxng_api_key (str, optional): The API key for the SearXNG API. Defaults to None. Consult SearXNG documentation for details.\n            k (int, optional): The number of top passages to retrieve. Defaults to 3.\n            is_valid_source (Callable, optional): A function that takes a URL and returns a boolean indicating if the\n            source is valid. Defaults to None.\n        \"\"\"\n        super().__init__(k=k)\n        if not searxng_api_url:\n            raise RuntimeError(\"You must supply searxng_api_url\")\n        self.searxng_api_url = searxng_api_url\n        self.searxng_api_key = searxng_api_key\n        self.usage = 0\n\n        if is_valid_source:\n            self.is_valid_source = is_valid_source\n        else:\n            self.is_valid_source = lambda x: True\n\n    def get_usage_and_reset(self):\n        usage = self.usage\n        self.usage = 0\n        return {\"SearXNG\": usage}\n\n    def forward(\n        self, query_or_queries: Union[str, List[str]], exclude_urls: List[str] = []\n    ):\n        \"\"\"Search with SearxNG for self.k top passages for query or queries","sourceCodeStart":646,"sourceCodeEnd":682,"githubUrl":"https://github.com/stanford-oval/storm/blob/fb951af7744dab086e34962e9bc6fe878e145f83/knowledge_storm/rm.py#L646-L682","documentation":"SearxNGRM.__init__ requires the URL of a SearXNG instance because, unlike hosted search APIs, SearXNG is self-hosted and there is no default endpoint. Without searxng_api_url the retriever has nothing to send queries to.","triggerScenarios":"Instantiating SearxNGRM() (or passing searxng_api_url=None/'') without specifying the instance URL, e.g. assuming a public default like searx.be exists.","commonSituations":"Developer forgets SearxNG must be self-hosted, passes only an API key, uses an env var the class does not read, or the URL string is empty due to a config loading bug.","solutions":["Run or identify a SearXNG instance and pass its URL: SearxNGRM(searxng_api_url='http://localhost:8080')","If self-hosting, deploy with docker: docker run -d -p 8080:8080 searxng/searxng","Confirm the instance has the JSON format enabled (search.formats includes json) if using API-key auth"],"exampleFix":"# before\nrm = SearxNGRM(k=3)\n\n# after\nrm = SearxNGRM(searxng_api_url='http://localhost:8080', k=3)","handlingStrategy":"validation","validationCode":"SEARXNG_URL = os.environ.get(\"SEARXNG_URL\")\nassert SEARXNG_URL, \"SearxNG instance URL required (self-hosted, e.g. http://localhost:8080)\"\nimport requests\nassert requests.get(f\"{SEARXNG_URL}/healthz\", timeout=5).ok, \"SearxNG instance unreachable\"","typeGuard":null,"tryCatchPattern":"try:\n    rm = SearxNGRM(searxng_api_url=SEARXNG_URL, k=3)\nexcept RuntimeError as e:\n    raise SystemExit(f'Config error: {e}') from e","preventionTips":["Document that SearxNG is self-hosted; provision it in docker-compose alongside the app","Add a startup connectivity check against the instance","Keep the instance URL in config, not hardcoded"],"tags":["configuration","searxng","self-hosted","missing-url","initialization"],"backgroundTag":"missing-required-parameter","analyzedSha":"fb951af7744dab086e34962e9bc6fe878e145f83","analyzedAt":"2026-08-28T11:56:54.780Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}