OpenBB-finance/OpenBB · warning · EmptyDataError
No data returned for the given query parameters.
Error message
No data returned for the given query parameters.
What it means
Raised in `transform_data` when the fetch stage produced zero rows (`data['data']` is empty). `EmptyDataError` is the provider-standard signal that the request was technically valid and executed, but the IMF returned no observations, so the platform can report 'no data' distinctly from a transport or validation failure.
Source
Thrown at openbb_platform/providers/imf/openbb_imf/models/economic_indicators.py:933
return {
"mode": "indicator",
"data": all_data,
"metadata": all_metadata,
}
@staticmethod
def transform_data(
query: ImfEconomicIndicatorsQueryParams,
data: dict,
**kwargs: Any,
) -> AnnotatedResult[list[ImfEconomicIndicatorsData]]:
"""Transform the data."""
mode = data.get("mode", "indicator")
row_data = data.get("data", [])
if not row_data:
raise EmptyDataError("No data returned for the given query parameters.")
result: list = []
metadata: dict = {}
if mode == "table":
metadata = {
"table": data.get("table_metadata", {}),
"series": data.get("series_metadata", {}),
}
else:
metadata = data.get("metadata", {})
for item in row_data:
# Filter by date range if needed (IMF API date filtering can be inconsistent)
item_date = item.get("TIME_PERIOD") or item.get("date")
# Normalize date format for comparison and storage
if item_date:View on GitHub (pinned to 3e071fcc2c)
Solutions
- Widen or remove start_date/end_date to cover the series' actual publication range.
- Verify the country code is reported for that indicator (check the IMF series page).
- Try a different `frequency` (A/Q/M) matching how the indicator is published.
- Drop transform/unit filters in case they select an unpopulated dimension slice.
Example fix
# before economic_indicators(indicator='NGDP_RPCH', country='W00', start_date='2025-01-01') # after economic_indicators(indicator='NGDP_RPCH', country='US', start_date='2000-01-01')
Defensive patterns
Strategy: try-catch
Try / catch
from openbb_core.provider.abstract.fetcher import EmptyDataError
try:
res = await obb.economy.imf.economic_indicators(...)
except EmptyDataError:
res = [] # or fall back to a wider query Prevention
- Probe coverage with one broad call before looping over fine-grained queries
- Validate country codes and frequency against the indicator's metadata
- Treat EmptyDataError as an expected, non-fatal outcome in batch pipelines
When it happens
Trigger: A combination of country, indicator, frequency, transform, and date filters that matches no IMF observations: e.g. a quarterly series requested with annual frequency, a country that does not report the indicator, or a date window entirely outside the series' coverage.
Common situations: Requesting recent periods for a series published with a long lag; using an ISO country code the dataflow does not cover; overly narrow start_date/end_date; wrong frequency for the indicator.
Related errors
- No data remaining after applying date filters. Try adjusting
- Error serializing output for an extension-modified endpoint
- OBBject Extension Error -> An OBBject extension that acts
- Invalid transform value '{query.transform}' for dataflow '{d
- No indicators specified.
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/1b956d4dbe125f9e.
Report an issue: GitHub.