OpenBB-finance/OpenBB · warning · EmptyDataError

No data returned from the Federal Reserve API.

Error message

No data returned from the Federal Reserve API.

What it means

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.

Source

Thrown at openbb_platform/providers/federal_reserve/openbb_federal_reserve/models/primary_dealer_fails.py:123

                data += response.get("pd", {}).get("timeseries", [])  # type: ignore
            return data
        except Exception as e:  # pylint: disable=broad-except
            raise OpenBBError(
                "Failed to fetch data from the Federal Reserve API."
            ) from e

    @staticmethod
    def transform_data(
        query: FederalReservePrimaryDealerFailsQueryParams,
        data: list[dict],
        **kwargs: Any,
    ) -> list[FederalReservePrimaryDealerFailsData]:
        """Transform the raw data into the standard format."""
        # pylint: disable=import-outside-toplevel
        from pandas import NA, DataFrame, concat, to_datetime

        if not data:
            raise EmptyDataError("No data returned from the Federal Reserve API.")

        df = DataFrame(data)
        df["title"] = df.keyid.map(FAILS_SERIES_TO_TITLE)
        df["value"] = df.value.astype(int)
        new_df = df.pivot(index="asofdate", columns="title", values="value").copy()
        new_data = new_df.copy()
        combined_df = DataFrame()

        for target in ["FTD", "FTR"]:
            total_col = target + " Total"
            new_data = new_df[[d for d in new_df.columns if target in d]].copy()
            new_data.loc[:, total_col] = new_data.sum(axis=1)

            if query.unit == "percent":
                new_data = new_data.div(new_data[total_col], axis=0)

            combined_df = (
                new_data.copy()

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Widen or shift the requested date range to days the fails data actually covers (business days within the published dataset window).
  2. Confirm the NY Fed endpoint is returning data by hitting the same URL directly (e.g. with curl) to rule out a temporary outage.
  3. Catch EmptyDataError in your caller and treat it as an empty result set rather than a crash.

Example fix

try:
    df = await obb.economy.fails_to_deliver(provider='federal_reserve').to_df()
except EmptyDataError:
    df = pd.DataFrame()  # handle no-data window gracefully
# before picking dates, verify they are business days within the dataset range
Defensive patterns

Strategy: try-catch

Try / catch

from openbb_core.provider.standard_errors import EmptyDataError
try:
    result = await obb.economy.fails_to_deliver(provider='federal_reserve')
except EmptyDataError:
    result = None  # treat as empty window, not a failure

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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