OpenBB-finance/OpenBB · error · OpenBBError

Unexpected result while retrieving the list of releases from

Error message

Unexpected result while retrieving the list of releases from the FRED API.

What it means

Raised in FredSearchFetcher.aextract_data (openbb_fred/models/search.py:220) when search_type='release' with no release_id and the /fred/releases response dict does not contain a truthy 'releases' key. Unlike the empty-result branches, this is an OpenBBError because the releases listing should never legitimately be empty - a missing key means the API call itself misbehaved. Typical root causes are an invalid/missing API key (FRED returns an error body instead of releases) or a changed response envelope.

Source

Thrown at openbb_platform/providers/fred/openbb_fred/models/search.py:220

                response = await fred_get(url)
                data = response.get("series_group")  # type: ignore
                if data:
                    data.update({"series_id": _id})
                    results.append(data)

            await asyncio.gather(*[get_one(_id) for _id in query.series_id.split(",")])

            if results:
                return results
            raise EmptyDataError("No results found for the provided series_id(s).")

        if query.search_type == "release" and query.release_id is None:
            url = f"https://api.stlouisfed.org/fred/releases?api_key={api_key}&file_type=json"
            response = await fred_get(url)
            results = response.get("releases")  # type: ignore
            if results:
                return results
            raise OpenBBError(
                "Unexpected result while retrieving the list of releases from the FRED API."
            )

        url = (
            "https://api.stlouisfed.org/fred/release/series?"
            if query.release_id is not None
            else "https://api.stlouisfed.org/fred/series/search?"
        )

        exclude = (
            ["search_text", "limit"] if query.release_id is not None else ["limit"]
        )

        if query.release_id is not None and query.order_by == "search_rank":
            query.order_by = None  # type: ignore

        querystring = get_querystring(query.model_dump(), exclude).replace(" ", "%20")
        url = url + querystring + f"&file_type=json&api_key={api_key}"

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Verify the FRED API key: obb.user.credentials.fred_api_key, and test it against https://api.stlouisfed.org/fred/releases?api_key=...&file_type=json in a browser.
  2. Set a valid key with 'obb.user.credentials.fred_api_key = <key>'.
  3. If the key is valid, check status.stlouisfed.org for an API incident and retry later.
  4. Report upstream if the raw response contains neither 'releases' nor an error_code.
Defensive patterns

Strategy: try-catch

Validate before calling

import requests

def fred_key_ok(key: str) -> bool:
    r = requests.get('https://api.stlouisfed.org/fred/releases',
                     params={'api_key': key, 'file_type': 'json'}, timeout=10)
    return 'releases' in r.json()

Type guard

def is_releases_response(payload: object) -> bool:
    """True when the payload looks like a FRED releases listing."""
    return isinstance(payload, dict) and isinstance(payload.get('releases'), list) and len(payload['releases']) > 0

Try / catch

from openbb_core.app.model.abstract.error import OpenBBError

try:
    releases = obb.economy.fred.search(search_type='release')
except OpenBBError as e:
    if 'Unexpected result while retrieving the list of releases' in str(e):
        # almost always a credentials problem; check key before retrying
        assert obb.user.credentials.fred_api_key, 'missing fred_api_key'
        raise

Prevention

When it happens

Trigger: fred_search(search_type='release') with an expired or mistyped fred_api_key; FRED API outage or maintenance returning an error JSON; a proxy rewriting the response.

Common situations: First call after installing without configuring the API key; keys rotated on the FRED account but not in OpenBB credentials; environment (dev/prod) pointing at different keys.

Related errors


AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14). Data as JSON: /api/errors/c11cc7f570b2ffa6. Report an issue: GitHub.