OpenBB-finance/OpenBB · warning · EmptyDataError

No data was found for the supplied date range and countries.

Error message

No data was found for the supplied date range and countries.

What it means

EmptyDataError raised in EconDbGdpNominalFetcher.transform_data after filtering the fetched records by query.start_date / query.end_date: the DataFrame became empty, meaning data exists but not inside the requested window. Note the fetch step succeeded — this is purely a date-range mismatch.

Source

Thrown at openbb_platform/providers/econdb/openbb_econdb/models/gdp_nominal.py:204

    @staticmethod
    def transform_data(
        query: EconDbGdpNominalQueryParams,
        data: list[dict],
        **kwargs,
    ) -> list[EconDbGdpNominalData]:
        """Transform the data."""
        # pylint: disable=import-outside-toplevel
        from pandas import DataFrame, to_datetime

        df = DataFrame(data)

        if query.start_date:
            df = df[to_datetime(df["date"]) >= to_datetime(query.start_date)]
        if query.end_date:
            df = df[to_datetime(df["date"]) <= to_datetime(query.end_date)]

        if df.empty:  # type: ignore
            raise EmptyDataError(
                "No data was found for the supplied date range and countries."
            )

        df = df.set_index(["date", "country"])  # type: ignore
        df = df.dropna()
        df["value"] = (df["value"] * 1_000_000_000).astype("int64")
        df["nominal_growth_qoq"] = df["nominal_growth_qoq"] / 100
        df["nominal_growth_yoy"] = df["nominal_growth_yoy"] / 100
        df = df.reset_index()
        df = df.sort_values(by=["date", "value"], ascending=[True, False])

        return [
            EconDbGdpNominalData.model_validate(d) for d in df.to_dict(orient="records")
        ]

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Widen or remove start_date/end_date and inspect the returned date range.
  2. Set start_date to the earliest date you actually need rather than a sentinel like '1900-01-01'.
  3. For recent periods, remember quarterly GDP lags — pull the last available quarter instead of the current one.

Example fix

# before
res = obb.economy.gdp_nominal(provider='econdb', country='us', start_date='1950-01-01', end_date='1960-01-01')  # before series begins

# after - omit dates to discover coverage first
res = obb.economy.gdp_nominal(provider='econdb', country='us')
print(res.to_df().date.min(), res.to_df().date.max())
Defensive patterns

Strategy: validation

Validate before calling

full = obb.economy.gdp_nominal(provider='econdb', country='us').to_df()
lo, hi = full['date'].min(), full['date'].max()
if start_date < lo or end_date > hi:
    raise ValueError(f'requested {start_date}..{end_date} outside coverage {lo}..{hi}')

Try / catch

from openbb_core.provider.utils.errors import EmptyDataError
try:
    res = obb.economy.gdp_nominal(provider='econdb', country='us', start_date=s, end_date=e)
except EmptyDataError:
    res = obb.economy.gdp_nominal(provider='econdb', country='us')  # full range, filter locally

Prevention

When it happens

Trigger: economy.gdp_nominal(provider='econdb', start_date/end_date set to a period before the series begins or after its latest observation, e.g. start_date='1990-01-01' for a country whose series starts in 2000, or a future end_date window with no data.

Common situations: Defaulting start_date far in the past; querying very recent quarters that are not yet published; timezone/day-boundary off-by-one on end_date.

Related errors


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