OpenBB-finance/OpenBB · warning · EmptyDataError

The request was returned empty.

Error message

The request was returned empty.

What it means

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.

Source

Thrown at openbb_platform/providers/fred/openbb_fred/models/bond_indices.py:570

        temp = await FredSeriesFetcher.fetch_data(item_query, credentials)
        result = [d.model_dump() for d in temp.result]
        results["metadata"] = temp.metadata
        results["data"] = result

        return results

    @staticmethod
    def transform_data(
        query: FredBondIndicesQueryParams,
        data: dict,
        **kwargs: Any,
    ) -> AnnotatedResult[list[FredBondIndicesData]]:
        """Transform data."""
        # pylint: disable=import-outside-toplevel
        from pandas import Categorical, DataFrame

        if not data:
            raise EmptyDataError("The request was returned empty.")
        df = DataFrame.from_records(data["data"])
        if df.empty:
            raise EmptyDataError(
                "No data found for the given query. Try adjusting the parameters."
            )
        # Flatten the data as a pivot table.
        df = (
            df.melt(id_vars="date", var_name="symbol", value_name="value")
            .query("value.notnull()")
            .set_index(["date", "symbol"])
            .sort_index()
            .reset_index()
        )
        # Normalize the percent values.
        if query.index_type != "total_return":
            df["value"] = df["value"] / 100

        titles_dict = {

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Widen or remove start_date/end_date to the full history
  2. Verify the mapped symbols exist on fred.stlouisfed.org
  3. Retry after a minute if FRED rate-limited the multi-series request
  4. Check the FRED API key is valid (invalid keys usually error earlier, but partial-auth states can return empty)
Defensive patterns

Strategy: try-catch

Validate before calling

raw = await fetch_fred_series_series(mapped_symbols, start_date, end_date)
assert raw, 'FRED returned an empty payload - check key and date range'

Type guard

def is_non_empty_payload(payload: object) -> bool:
    return isinstance(payload, dict) and len(payload) > 0

Try / catch

from openbb_core.provider.utils.errors import EmptyDataError
try:
    rows = await obb.economy.bond_indices(provider='fred', **params).await_to_list()
except EmptyDataError:
    rows = []  # retry with wider window

Prevention

When it happens

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

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

Related errors


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