stanford-oval/storm · error · Exception

Error: Unable to retrieve results. Status code: {response.st

Error message

Error: Unable to retrieve results. Status code: {response.status_code}

What it means

VectorRM._retrieve queries the You.com web-search API and, when the HTTP response status is not 200, raises a generic Exception with the status code. This surfaces through forward() when running STORM with source='you'. The status code distinguishes causes: 401/403 bad API key, 429 rate limit, 4xx bad params, 5xx upstream outage.

Source

Thrown at knowledge_storm/rm.py:383

            results = []
            for response_data in response_data_list:
                result = {
                    "title": response_data["document_title"],
                    "url": response_data["url"],
                    "snippets": [response_data["content"]],
                    "description": response_data.get("description", "N/A"),
                    "meta": {
                        key: value
                        for key, value in response_data.items()
                        if key not in ["document_title", "url", "content"]
                    },
                }

                results.append(result)

            return results
        else:
            raise Exception(
                f"Error: Unable to retrieve results. Status code: {response.status_code}"
            )

    def forward(
        self, query_or_queries: Union[str, List[str]], exclude_urls: List[str] = []
    ):
        collected_results = []
        queries = (
            [query_or_queries]
            if isinstance(query_or_queries, str)
            else query_or_queries
        )

        for query in queries:
            try:
                results = self._retrieve(query)
                collected_results.extend(results)
            except Exception as e:

View on GitHub (pinned to fb951af774)

Solutions

  1. Check the status code in the message: 401/403 -> fix YDC_API_KEY; 429 -> add backoff/retries or reduce k/query_params['num']; 5xx -> retry after a delay
  2. Verify the key: echo $YDC_API_KEY and test a single curl request to the You.com API
  3. Catch the exception per-query in your pipeline so one failed search doesn't kill the whole run
  4. If limits persist, switch VectorRM to another source (serper, bing, etc.)

Example fix

// before
results = rm.forward([query])  # Exception: Error: Unable to retrieve results. Status code: 429
// after
from tenacity import retry, wait_exponential, stop_after_attempt
@retry(wait=wait_exponential(multiplier=2), stop=stop_after_attempt(4))
def safe_forward(rm, q):
    try:
        return rm.forward(q)
    except Exception as e:
        if '429' in str(e) or '5' in str(e).split()[-1]:
            raise
        return []
results = safe_forward(rm, [query])
Defensive patterns

Strategy: retry

Validate before calling

import os
if not os.getenv('YDC_API_KEY'):
    raise SystemExit('Set YDC_API_KEY for the you.com retrieval source')

Try / catch

import time
def search_with_retry(rm, query, attempts=4):
    for i in range(attempts):
        try:
            return rm.forward(query)
        except Exception as e:
            code = str(e).rsplit(' ', 1)[-1]
            if code in ('401', '403'):
                raise SystemExit('Invalid YDC_API_KEY')
            if i == attempts - 1:
                return []  # degrade gracefully per-query
            time.sleep(2 ** (i + 1))
    return []

Prevention

When it happens

Trigger: Calling rm.forward(...) / a STORM pipeline run with engine='you' when the You.com API returns non-200: invalid or unset YDC_API_KEY, exhausted quota/rate limit, or transient 5xx from the service.

Common situations: Expired You.com API key or key never exported; free-tier rate limits during a long multi-query STORM run (many queries per article); transient upstream errors treated as fatal because any non-200 raises.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


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