stanford-oval/storm · critical · RuntimeError

You must supply searxng_api_url

Error message

You must supply searxng_api_url

What it means

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.

Source

Thrown at knowledge_storm/rm.py:664

        self,
        searxng_api_url,
        searxng_api_key=None,
        k=3,
        is_valid_source: Callable = None,
    ):
        """Initialize the SearXNG search retriever.
        Please set up SearXNG according to https://docs.searxng.org/index.html.

        Args:
            searxng_api_url (str): The URL of the SearXNG API. Consult SearXNG documentation for details.
            searxng_api_key (str, optional): The API key for the SearXNG API. Defaults to None. Consult SearXNG documentation for details.
            k (int, optional): The number of top passages to retrieve. Defaults to 3.
            is_valid_source (Callable, optional): A function that takes a URL and returns a boolean indicating if the
            source is valid. Defaults to None.
        """
        super().__init__(k=k)
        if not searxng_api_url:
            raise RuntimeError("You must supply searxng_api_url")
        self.searxng_api_url = searxng_api_url
        self.searxng_api_key = searxng_api_key
        self.usage = 0

        if is_valid_source:
            self.is_valid_source = is_valid_source
        else:
            self.is_valid_source = lambda x: True

    def get_usage_and_reset(self):
        usage = self.usage
        self.usage = 0
        return {"SearXNG": usage}

    def forward(
        self, query_or_queries: Union[str, List[str]], exclude_urls: List[str] = []
    ):
        """Search with SearxNG for self.k top passages for query or queries

View on GitHub (pinned to fb951af774)

Solutions

  1. Run or identify a SearXNG instance and pass its URL: SearxNGRM(searxng_api_url='http://localhost:8080')
  2. If self-hosting, deploy with docker: docker run -d -p 8080:8080 searxng/searxng
  3. Confirm the instance has the JSON format enabled (search.formats includes json) if using API-key auth

Example fix

# before
rm = SearxNGRM(k=3)

# after
rm = SearxNGRM(searxng_api_url='http://localhost:8080', k=3)
Defensive patterns

Strategy: validation

Validate before calling

SEARXNG_URL = os.environ.get("SEARXNG_URL")
assert SEARXNG_URL, "SearxNG instance URL required (self-hosted, e.g. http://localhost:8080)"
import requests
assert requests.get(f"{SEARXNG_URL}/healthz", timeout=5).ok, "SearxNG instance unreachable"

Try / catch

try:
    rm = SearxNGRM(searxng_api_url=SEARXNG_URL, k=3)
except RuntimeError as e:
    raise SystemExit(f'Config error: {e}') from e

Prevention

When it happens

Trigger: Instantiating SearxNGRM() (or passing searxng_api_url=None/'') without specifying the instance URL, e.g. assuming a public default like searx.be exists.

Common situations: 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.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


AI-assisted analysis of stanford-oval/storm@fb951af774 (2026-08-28). Data as JSON: /api/errors/c81f08b121db63f5. Report an issue: GitHub.