OpenBB-finance/OpenBB · error · ValueError
No data available for the requested time period. Data for th
Error message
No data available for the requested time period. Data for this table with country '{fetch_kwargs.get('COUNTRY', 'N/A')}' is only available from {time_start} to {time_end}. Your request: {start_date or 'beginning'} to {end_date or 'present'}. What it means
Date-range validation: after fetching the table's availability window (time_start/time_end) for the selected country, the builder compares it with the user's requested start_date/end_date. If the ranges do not overlap at all, it raises immediately instead of returning an empty DataFrame, telling you exactly what window is actually available.
Source
Thrown at openbb_platform/providers/imf/openbb_imf/utils/table_builder.py:832
return datetime(int(date_str[:4]), 1, 1)
try:
avail_start = parse_date(time_start)
avail_end = parse_date(time_end)
req_start = parse_date(start_date) if start_date else None
req_end = parse_date(end_date) if end_date else None
except (ValueError, TypeError):
# Date parsing failed - skip validation
break
no_overlap = False
if req_start and avail_end and req_start > avail_end:
no_overlap = True
if req_end and avail_start and req_end < avail_start:
no_overlap = True
if no_overlap:
raise ValueError(
f"No data available for the requested time period. "
f"Data for this table with country "
f"'{fetch_kwargs.get('COUNTRY', 'N/A')}' is only available "
f"from {time_start} to {time_end}. "
f"Your request: {start_date or 'beginning'} to {end_date or 'present'}."
)
break
# Extract post-fetch filter codes before passing to fetch_data
indicator_codes_to_filter = fetch_kwargs.pop("_indicator_codes_to_filter", None)
# Skip validation in fetch_data since we already validated progressively
data_result = self.query_builder.fetch_data(
dataflow=dataflow,
start_date=start_date,
end_date=end_date,
limit=limit,
_skip_validation=True, # We already validated aboveView on GitHub (pinned to 3e071fcc2c)
Solutions
- Read the message: it states the available from/to window - re-request within that range.
- Omit start_date/end_date (or widen them) to let the builder use full available history.
- Verify date strings are ISO format (YYYY-MM-DD) so parse_date doesn't misread them.
- For late-joining countries, first call the availability endpoint to discover the window programmatically.
Example fix
# before
obb.economy.imf.fetch(dataset='IFS', parameters={'COUNTRY': 'MNE'}, start_date='1995-01-01')
# after - Montenegro data starts later; use the window from the error
obb.economy.imf.fetch(dataset='IFS', parameters={'COUNTRY': 'MNE'}, start_date='2006-01-01') Defensive patterns
Strategy: validation
Validate before calling
# Discover the availability window before requesting a range
meta = obb.economy.imf.fetch(dataset='IFS', parameters={'COUNTRY': c}, limit=1)
start = meta.results[0].date if meta.results else None
# then clamp your request to [max(requested_start, availability_start), ...] Type guard
from datetime import date
def ranges_overlap(req: tuple[date, date], avail: tuple[date, date]) -> bool:
return req[0] <= avail[1] and req[1] >= avail[0] Try / catch
try:
res = obb.economy.imf.fetch(..., start_date=s, end_date=e)
except ValueError as e:
if 'only available from' in str(e):
# parse window from message, clamp request, retry once
new_start, new_end = parse_window(str(e))
res = obb.economy.imf.fetch(..., start_date=max(s, new_start), end_date=min(e, new_end))
else:
raise Prevention
- Always send ISO dates (YYYY-MM-DD)
- For late-joining countries, probe availability first
- Omit dates when full history is acceptable
When it happens
Trigger: Requesting dates entirely outside the data's coverage - e.g. start_date='1990-01-01' when the table only starts in 2005, or end_date before the series begins. Only fires when parse_date succeeds on both sides and the overlap test fails (req_start > avail_end or req_end < avail_start).
Common situations: Assuming long histories for countries that joined a dataset late (e.g. new euro members in IFS); passing year-first vs month-first date strings that parse into unexpected dates; querying brand-new tables whose history is short.
Related errors
- No valid indicator codes found after filtering and dimension
- Invalid value(s) for dimension '{dim_id}': {invalid_values}.
- No data available: Table indicator codes do not match availa
- Table indicators could not be mapped to dimension(s) {unmapp
- Invalid value(s) for dimension '{dim_id}': {invalid_values}.
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/ee0ff46137c61115.
Report an issue: GitHub.