OpenBB-finance/OpenBB · warning · EmptyDataError

No data found for the given query. Try adjusting the paramet

Error message

No data found for the given query. Try adjusting the parameters.

What it means

Raised by FredBondIndicesFetch.transform_data when the payload exists but DataFrame.from_records(data['data']) yields an empty frame - the 'data' key held no observation records (or only header-ish entries). This catches the case where the FRED envelope is present yet contains zero rows after date filtering.

Source

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

        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 = {
            symbol: data["metadata"][symbol].get("title")
            for symbol in query._symbols.split(",")  # type: ignore  # pylint: disable=protected-access
        }

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Query without date filters to find the series' actual observation range, then re-query inside it
  2. Check the series inception date on FRED's website for the mapped symbols
  3. Move the window back one publication period (daily/monthly depending on the index)
  4. Choose a longer-lived index within the same category

Example fix

# before
res = await obb.economy.bond_indices(provider='fred', category='emerging_markets', index='high_yield', start_date='1990-01-01', end_date='1995-12-31').await_to_list()

# after - use a window inside the series' coverage
res = await obb.economy.bond_indices(provider='fred', category='emerging_markets', index='high_yield', start_date='2015-01-01', end_date='2024-12-31').await_to_list()
Defensive patterns

Strategy: validation

Validate before calling

from pandas import DataFrame
payload = await fetch_fred(symbols, start_date, end_date)
df = DataFrame.from_records(payload.get('data', []))
assert not df.empty, 'no observations in window - check series inception dates'

Type guard

def has_records(payload: dict) -> bool:
    return len(payload.get("data", {})) > 0

Try / catch

from openbb_core.provider.utils.errors import EmptyDataError
try:
    rows = await obb.economy.bond_indices(provider='fred', start_date=s, end_date=e).await_to_list()
except EmptyDataError as e:
    if 'adjusting the parameters' in str(e):
        rows = await obb.economy.bond_indices(provider='fred').await_to_list()  # full history

Prevention

When it happens

Trigger: FRED returns {'metadata': ..., 'data': {}} or {'data': []} for the requested BAML symbols - the series exist but have no observations in the requested window (e.g. dates before the index inception, or between publication dates).

Common situations: start_date earlier than the series' first observation with a narrow window that still misses all data; discontinued series; FRED publication lags for recent dates.

Related errors


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