OpenBB-finance/OpenBB · warning · EmptyDataError

The request was returned empty.

Error message

The request was returned empty.

What it means

EmptyDataError raised in ECBYieldCurveFetcher.transform_data when the data list handed from extract_data is empty — i.e. extraction technically produced nothing (or every observation failed validation upstream). Distinct from error 284, which fires per-maturity during extraction; this is the transform-stage backstop.

Source

Thrown at openbb_platform/providers/ecb/openbb_ecb/models/yield_curve.py:135

        tasks = [get_one(maturity, query.use_cache) for maturity in MATURITIES]

        await asyncio.gather(*tasks)

        return results

    @staticmethod
    def transform_data(
        query: ECBYieldCurveQueryParams,
        data: list[dict],
        **kwargs: Any,
    ) -> list[ECBYieldCurveData]:
        """Transform data."""
        # pylint: disable=import-outside-toplevel
        from openbb_ecb.utils.yield_curve_series import MATURITIES  # noqa
        from pandas import Categorical, DataFrame, DatetimeIndex  # noqa

        if not data:
            raise EmptyDataError("The request was returned empty.")
        dates = (
            str(query.date).split(",")
            if query.date
            else [datetime.now().strftime("%Y-%m-%d")]
        )
        dates_list = DatetimeIndex(dates)

        # Find the nearest date to the requested one.
        df = DataFrame(data).set_index("date").query("`rate`.notnull()")
        df.index = DatetimeIndex(df.index)
        df_unique_dates = df[
            ~df.index.duplicated(keep="first")
        ].sort_index()  # DataFrame with unique dates
        nearest_dates = [df_unique_dates.index.asof(date) for date in dates_list]
        # Filter for only the nearest dates
        df = df[df.index.isin(nearest_dates)]

        # Flatten the DataFrame

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Query the most recent business day explicitly instead of relying on today's date.
  2. Retry later the same day — the ECB curve is published mid-day CET.
  3. Verify the raw API per maturity (data.ecb.europa.eu/data-detail-api) to confirm data exists for that date.
  4. Treat EmptyDataError as 'no result' rather than a crash and fall back to the prior business day.

Example fix

# before
curve = obb.fixedincome.government_yield_curve(provider="ecb", date="2025-01-05")  # Sunday

# after
from pandas.tseries.offsets import BDay
last_bday = (pd.Timestamp.today() - BDay(1)).strftime("%Y-%m-%d")
curve = obb.fixedincome.government_yield_curve(provider="ecb", date=last_bday)
Defensive patterns

Strategy: validation

Validate before calling

import pandas as pd
from pandas.tseries.offsets import BDay

def valid_curve_date(d: str) -> str:
    ts = pd.Timestamp(d) if d else (pd.Timestamp.today() - BDay(1))
    if ts.weekday() >= 5:
        ts = ts - BDay(1)  # roll off weekend
    return ts.strftime("%Y-%m-%d")

Try / catch

from openbb_core.provider.utils.errors import EmptyDataError
try:
    curve = obb.fixedincome.government_yield_curve(provider="ecb", date=d)
except EmptyDataError:
    curve = obb.fixedincome.government_yield_curve(provider="ecb", date=prev_business_day(d))

Prevention

When it happens

Trigger: The extract stage returned an empty list without raising (e.g. all responses were non-list empty dicts), or downstream code filtered out every row before transform. Also reached when the requested date has no curve published (weekends/holidays are filtered by nearest-date matching).

Common situations: Requesting a specific query.date that falls on a weekend or ECB holiday; ECB publishing delay on the current business day; partial outages where responses are non-empty falsy shapes.

Related errors


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