{"record":{"id":"460b42fdceeeee9e","repo":"OpenBB-finance/OpenBB","slug":"the-request-was-returned-empty-460b42","errorCode":null,"errorMessage":"The request was returned empty.","messagePattern":"The request was returned empty\\.","errorType":"exception","errorClass":"EmptyDataError","httpStatus":null,"severity":"warning","filePath":"openbb_platform/providers/fred/openbb_fred/models/bond_indices.py","lineNumber":570,"sourceCode":"        temp = await FredSeriesFetcher.fetch_data(item_query, credentials)\n        result = [d.model_dump() for d in temp.result]\n        results[\"metadata\"] = temp.metadata\n        results[\"data\"] = result\n\n        return results\n\n    @staticmethod\n    def transform_data(\n        query: FredBondIndicesQueryParams,\n        data: dict,\n        **kwargs: Any,\n    ) -> AnnotatedResult[list[FredBondIndicesData]]:\n        \"\"\"Transform data.\"\"\"\n        # pylint: disable=import-outside-toplevel\n        from pandas import Categorical, DataFrame\n\n        if not data:\n            raise EmptyDataError(\"The request was returned empty.\")\n        df = DataFrame.from_records(data[\"data\"])\n        if df.empty:\n            raise EmptyDataError(\n                \"No data found for the given query. Try adjusting the parameters.\"\n            )\n        # Flatten the data as a pivot table.\n        df = (\n            df.melt(id_vars=\"date\", var_name=\"symbol\", value_name=\"value\")\n            .query(\"value.notnull()\")\n            .set_index([\"date\", \"symbol\"])\n            .sort_index()\n            .reset_index()\n        )\n        # Normalize the percent values.\n        if query.index_type != \"total_return\":\n            df[\"value\"] = df[\"value\"] / 100\n\n        titles_dict = {","sourceCodeStart":552,"sourceCodeEnd":588,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/fred/openbb_fred/models/bond_indices.py#L552-L588","documentation":"Raised by FredBondIndicesFetch.transform_data when the fetched payload dict itself is falsy - the multi-series FRED extraction returned nothing at all before the DataFrame was built. Sister check at line 573 catches a non-empty payload whose 'data' records list is empty.","triggerScenarios":"The FRED series API call for the mapped BAML symbols returned an empty dict - typically when none of the symbols exist for the user's date parameters or the request failed upstream and returned {}.","commonSituations":"Date ranges outside FRED coverage for the chosen bond index series; FRED API throttling returning an empty structure; transformation kwargs (aggregation_method, transform) that eliminate all observations.","solutions":["Widen or remove start_date/end_date to the full history","Verify the mapped symbols exist on fred.stlouisfed.org","Retry after a minute if FRED rate-limited the multi-series request","Check the FRED API key is valid (invalid keys usually error earlier, but partial-auth states can return empty)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"raw = await fetch_fred_series_series(mapped_symbols, start_date, end_date)\nassert raw, 'FRED returned an empty payload - check key and date range'","typeGuard":"def is_non_empty_payload(payload: object) -> bool:\n    return isinstance(payload, dict) and len(payload) > 0","tryCatchPattern":"from openbb_core.provider.utils.errors import EmptyDataError\ntry:\n    rows = await obb.economy.bond_indices(provider='fred', **params).await_to_list()\nexcept EmptyDataError:\n    rows = []  # retry with wider window","preventionTips":["Verify the mapped BAML symbols exist on FRED before bulk queries","Avoid restrictive date filters on first discovery calls","Rate-limit FRED requests to prevent throttled empty responses"],"tags":["fred","bond-indices","empty-data"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}