{"record":{"id":"c11cc7f570b2ffa6","repo":"OpenBB-finance/OpenBB","slug":"unexpected-result-while-retrieving-the-list-of-rel","errorCode":null,"errorMessage":"Unexpected result while retrieving the list of releases from the FRED API.","messagePattern":"Unexpected result while retrieving the list of releases from the FRED API\\.","errorType":"exception","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/fred/openbb_fred/models/search.py","lineNumber":220,"sourceCode":"                response = await fred_get(url)\n                data = response.get(\"series_group\")  # type: ignore\n                if data:\n                    data.update({\"series_id\": _id})\n                    results.append(data)\n\n            await asyncio.gather(*[get_one(_id) for _id in query.series_id.split(\",\")])\n\n            if results:\n                return results\n            raise EmptyDataError(\"No results found for the provided series_id(s).\")\n\n        if query.search_type == \"release\" and query.release_id is None:\n            url = f\"https://api.stlouisfed.org/fred/releases?api_key={api_key}&file_type=json\"\n            response = await fred_get(url)\n            results = response.get(\"releases\")  # type: ignore\n            if results:\n                return results\n            raise OpenBBError(\n                \"Unexpected result while retrieving the list of releases from the FRED API.\"\n            )\n\n        url = (\n            \"https://api.stlouisfed.org/fred/release/series?\"\n            if query.release_id is not None\n            else \"https://api.stlouisfed.org/fred/series/search?\"\n        )\n\n        exclude = (\n            [\"search_text\", \"limit\"] if query.release_id is not None else [\"limit\"]\n        )\n\n        if query.release_id is not None and query.order_by == \"search_rank\":\n            query.order_by = None  # type: ignore\n\n        querystring = get_querystring(query.model_dump(), exclude).replace(\" \", \"%20\")\n        url = url + querystring + f\"&file_type=json&api_key={api_key}\"","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/fred/openbb_fred/models/search.py#L202-L238","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","Set a valid key with 'obb.user.credentials.fred_api_key = <key>'.","If the key is valid, check status.stlouisfed.org for an API incident and retry later.","Report upstream if the raw response contains neither 'releases' nor an error_code."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import requests\n\ndef fred_key_ok(key: str) -> bool:\n    r = requests.get('https://api.stlouisfed.org/fred/releases',\n                     params={'api_key': key, 'file_type': 'json'}, timeout=10)\n    return 'releases' in r.json()","typeGuard":"def is_releases_response(payload: object) -> bool:\n    \"\"\"True when the payload looks like a FRED releases listing.\"\"\"\n    return isinstance(payload, dict) and isinstance(payload.get('releases'), list) and len(payload['releases']) > 0","tryCatchPattern":"from openbb_core.app.model.abstract.error import OpenBBError\n\ntry:\n    releases = obb.economy.fred.search(search_type='release')\nexcept OpenBBError as e:\n    if 'Unexpected result while retrieving the list of releases' in str(e):\n        # almost always a credentials problem; check key before retrying\n        assert obb.user.credentials.fred_api_key, 'missing fred_api_key'\n        raise","preventionTips":["Smoke-test the API key once at startup with a /fred/releases call.","Cache the (rarely changing) releases listing locally instead of re-fetching per request."],"tags":["fred","api-key","unexpected-response","releases"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}