OpenBB-finance/OpenBB · warning · EmptyDataError

No data found for the provided dates. Data has a range from

Error message

No data found for the provided dates. Data has a range from {df.date.min()} to {df.date.max()}.

What it means

EmptyDataError raised at the end of EconDbPortVolumeFetcher.transform_data: after mapping countries and applying start_date/end_date filters, the DataFrame has zero rows, and the message reports the dataset's actual min/max dates. The data exists but lies outside your requested window (dataset starts 2022-04-04; see the query-param validator in the same file).

Source

Thrown at openbb_platform/providers/econdb/openbb_econdb/models/port_volume.py:172

            "Dwelling times imports": "import_dwell_time",
            "Dwelling times exports": "export_dwell_time",
            "Imports": "import_teu",
            "Exports": "export_teu",
        }
        df = df.rename(columns=cols_map).reset_index().convert_dtypes()
        df.country = df.country.map(
            {v: k.replace("_", " ").title() for k, v in COUNTRY_MAP.items()}
        )
        df.date = to_datetime(df.date).dt.date

        if query.start_date:
            df = df[df.date >= query.start_date]

        if query.end_date:
            df = df[df.date <= query.end_date]

        if len(df) == 0:
            raise EmptyDataError(
                f"No data found for the provided dates. Data has a range from {df.date.min()} to {df.date.max()}."
            )

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

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Read the min/max dates from the error message and set your window inside that range.
  2. Omit dates to fetch the full range, then filter locally.
  3. Keep end_date at least a few days before today to account for publication lag.

Example fix

# before
obb.economy.port_volume(provider='econdb', start_date='2026-08-10', end_date='2026-08-14')  # likely unpublished week

# after
obb.economy.port_volume(provider='econdb')  # full range; filter locally afterwards
Defensive patterns

Strategy: validation

Validate before calling

full = obb.economy.port_volume(provider='econdb').to_df()
lo, hi = full['date'].min(), full['date'].max()
if not (lo <= start_date <= hi) or not (lo <= end_date <= hi):
    start_date, end_date = max(start_date, lo), min(end_date, hi)

Try / catch

from openbb_core.provider.utils.errors import EmptyDataError
try:
    res = obb.economy.port_volume(provider='econdb', start_date=s, end_date=e)
except EmptyDataError as err:
    # message contains the true range: 'Data has a range from X to Y.'
    logger.warning(str(err))
    res = obb.economy.port_volume(provider='econdb')

Prevention

When it happens

Trigger: economy.port_volume(provider='econdb', start_date/end_date) filtering out all rows: end_date before 2022-04-04, start_date after the dataset's last date, or a window narrower than the weekly data points.

Common situations: Recent end_date beyond the latest published week; windows that fall between weekly data points; assuming longer history than 2022-04-04.

Related errors


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