{"record":{"id":"1c136285705db83c","repo":"OpenBB-finance/OpenBB","slug":"no-data-returned-from-the-federal-reserve-api","errorCode":null,"errorMessage":"No data returned from the Federal Reserve API.","messagePattern":"No data returned from the Federal Reserve API\\.","errorType":"exception","errorClass":"EmptyDataError","httpStatus":null,"severity":"warning","filePath":"openbb_platform/providers/federal_reserve/openbb_federal_reserve/models/primary_dealer_fails.py","lineNumber":123,"sourceCode":"                data += response.get(\"pd\", {}).get(\"timeseries\", [])  # type: ignore\n            return data\n        except Exception as e:  # pylint: disable=broad-except\n            raise OpenBBError(\n                \"Failed to fetch data from the Federal Reserve API.\"\n            ) from e\n\n    @staticmethod\n    def transform_data(\n        query: FederalReservePrimaryDealerFailsQueryParams,\n        data: list[dict],\n        **kwargs: Any,\n    ) -> list[FederalReservePrimaryDealerFailsData]:\n        \"\"\"Transform the raw data into the standard format.\"\"\"\n        # pylint: disable=import-outside-toplevel\n        from pandas import NA, DataFrame, concat, to_datetime\n\n        if not data:\n            raise EmptyDataError(\"No data returned from the Federal Reserve API.\")\n\n        df = DataFrame(data)\n        df[\"title\"] = df.keyid.map(FAILS_SERIES_TO_TITLE)\n        df[\"value\"] = df.value.astype(int)\n        new_df = df.pivot(index=\"asofdate\", columns=\"title\", values=\"value\").copy()\n        new_data = new_df.copy()\n        combined_df = DataFrame()\n\n        for target in [\"FTD\", \"FTR\"]:\n            total_col = target + \" Total\"\n            new_data = new_df[[d for d in new_df.columns if target in d]].copy()\n            new_data.loc[:, total_col] = new_data.sum(axis=1)\n\n            if query.unit == \"percent\":\n                new_data = new_data.div(new_data[total_col], axis=0)\n\n            combined_df = (\n                new_data.copy()","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/federal_reserve/openbb_federal_reserve/models/primary_dealer_fails.py#L105-L141","documentation":"Raised by FederalReservePrimaryDealerFailsFetch.transform_data when the list of raw records passed in is empty, meaning the underlying NY Fed fails-to-deliver request produced no rows before transformation ever ran. It is an EmptyDataError, so the OpenBB router surfaces it as a 'no results' condition rather than a hard failure. It does not indicate a malformed request; the API simply returned nothing for the symbols/dates requested.","triggerScenarios":"Calling obb.economy.fails_to_deliver() (federal_reserve provider) for a date range where the NY Fed fails dataset has no rows, or when the fetch step's keyid series values all map to nothing and the request returns an empty payload. Also happens when upstream amake_request silently returns [] on a degraded API response.","commonSituations":"Querying weekends/holidays or ranges before the dataset begins; a temporary NY Fed API outage that returns 200 with an empty body; typo'd or out-of-range start_date/end_date in the QueryParams.","solutions":["Widen or shift the requested date range to days the fails data actually covers (business days within the published dataset window).","Confirm the NY Fed endpoint is returning data by hitting the same URL directly (e.g. with curl) to rule out a temporary outage.","Catch EmptyDataError in your caller and treat it as an empty result set rather than a crash."],"exampleFix":"try:\n    df = await obb.economy.fails_to_deliver(provider='federal_reserve').to_df()\nexcept EmptyDataError:\n    df = pd.DataFrame()  # handle no-data window gracefully\n# before picking dates, verify they are business days within the dataset range","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from openbb_core.provider.standard_errors import EmptyDataError\ntry:\n    result = await obb.economy.fails_to_deliver(provider='federal_reserve')\nexcept EmptyDataError:\n    result = None  # treat as empty window, not a failure","preventionTips":["Restrict requested dates to business days inside the dataset's published range","Check the NY Fed endpoint manually before batch jobs"],"tags":["openbb","federal-reserve","empty-data","api"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}