OpenBB-finance/OpenBB · warning · EmptyDataError

No data remaining after applying date filters. Try adjusting

Error message

No data remaining after applying date filters. Try adjusting start_date and end_date parameters.

What it means

Raised after row-level filtering when every fetched observation was discarded by the start_date/end_date comparison, i.e. the IMF returned data but none of it falls inside the requested window. This catches the case where a `limit`-driven fetch (which pulls the most recent N periods regardless of dates) does not overlap the caller's date range.

Source

Thrown at openbb_platform/providers/imf/openbb_imf/models/economic_indicators.py:1076

                    "indicator_codes",
                    "COUNTRY",
                    "country_code",
                    "SCALE",
                    "UNIT",
                    "unit_multiplier",
                }:
                    continue
                # Include dimension fields (UPPERCASE) and their _code variants
                if key.isupper() or key.endswith("_code"):
                    # Convert to snake_case for the field name
                    field_name = key.lower()
                    new_row[field_name] = val

            result.append(new_row)

        # Check if all records were filtered out
        if not result:
            raise EmptyDataError(
                "No data remaining after applying date filters. "
                "Try adjusting start_date and end_date parameters."
            )

        result.sort(
            key=lambda x: (
                x["order"] if x.get("order") is not None else 9999,
                x["date"] if x.get("date") else "",
                x["country"] or "",
            )
        )
        to_exclude = [
            "is_category_header",
            "hierarchy_node_id",
            "parent_id",
            "indicator_code",
            "parent_code",
            "series_id",

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Drop `limit` when using historical start_date/end_date so the full series is fetched then filtered.
  2. Shift start_date/end_date to overlap the series' published range (check the latest available period first with an unlimited call).
  3. Loosen or remove the date filters entirely and slice locally after download.

Example fix

# before
economic_indicators(indicator='NGDP_RPCH', limit=5, start_date='1990-01-01', end_date='1999-12-31')

# after
economic_indicators(indicator='NGDP_RPCH', start_date='1990-01-01', end_date='1999-12-31')
Defensive patterns

Strategy: validation

Validate before calling

# Do not combine limit with historical date windows
if start_date and query_kwargs.get('limit') is not None:
    if int(start_date[:4]) < CURRENT_YEAR - query_kwargs['limit']:
        del query_kwargs['limit']  # full fetch, filter locally

Try / catch

except EmptyDataError as e:
    if 'date filters' in str(e):
        res = await fetch(**{**kwargs, 'start_date': None, 'end_date': None})
        res = [r for r in res if in_window(r.date)]  # filter locally

Prevention

When it happens

Trigger: Setting start_date/end_date to a historical window while `limit` pulls only the most recent observations; or requesting a date range newer than the latest published observation, so post-fetch date filtering removes all rows.

Common situations: Combining `limit` with historical date filters; expecting current-year data for a series published with lag; timezone/annual-vs-quarterly date string mismatches causing strict comparisons to exclude everything.

Related errors


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