OpenBB-finance/OpenBB · error · ValueError
No tables/hierarchies found for dataflow '{dataflow}'
Error message
No tables/hierarchies found for dataflow '{dataflow}' What it means
When table_id is omitted, get_table auto-selects only if the dataflow exposes exactly one table hierarchy; zero hierarchies triggers ValueError. It means IMF metadata contains no presentation tables/hierarchies for this dataflow, so table-mode fetching is impossible.
Source
Thrown at openbb_platform/providers/imf/openbb_imf/utils/table_builder.py:190
if dataflow is None:
raise ValueError(
"dataflow is required. Either provide it directly or use "
"table_id in 'dataflow_id::table_id' format."
)
# Validate parameter combinations using progressive helper
if kwargs or start_date or end_date:
self._validate_dimension_constraints(
dataflow, start_date=start_date, end_date=end_date, **kwargs
)
# If table_id not provided, auto-select if only one table available
if table_id is None:
available_tables = self.metadata.get_dataflow_hierarchies(dataflow)
if len(available_tables) == 1:
table_id = available_tables[0]["id"]
elif len(available_tables) == 0:
raise ValueError(
f"No tables/hierarchies found for dataflow '{dataflow}'"
)
table_structure = self.metadata.get_dataflow_table_structure(dataflow, table_id)
table_metadata = {
"hierarchy_id": table_structure["hierarchy_id"],
"hierarchy_name": table_structure["hierarchy_name"],
"hierarchy_description": table_structure["hierarchy_description"],
"dataflow_id": table_structure["dataflow_id"],
"codelist_id": table_structure["codelist_id"],
"agency_id": table_structure["agency_id"],
"version": table_structure["version"],
"total_groups": table_structure["total_groups"],
"type": table_structure["type"],
}
filtered_hierarchy_entries = table_structure["indicators"]
if indicators is not None:View on GitHub (pinned to 3e071fcc2c)
Solutions
- Check metadata.get_dataflow_hierarchies(dataflow): if empty, this dataflow has no tables — use ImfQueryBuilder.build_url/fetch_data with dimensions instead.
- Refresh cached metadata in case hierarchies exist upstream but not in cache.
- Pass an explicit table_id if you know one exists from the IMF portal.
Example fix
# before
result = tb.get_table(dataflow='FLAT_DATAFLOW') # no hierarchies -> ValueError
# after
from openbb_imf.utils.query_builder import ImfQueryBuilder
if ImfQueryBuilder().metadata.get_dataflow_hierarchies('FLAT_DATAFLOW'):
result = tb.get_table(dataflow='FLAT_DATAFLOW')
else:
df = ImfQueryBuilder().fetch_data(ImfQueryBuilder().build_url('FLAT_DATAFLOW')) Defensive patterns
Strategy: type-guard
Validate before calling
from openbb_imf.utils.query_builder import ImfQueryBuilder
def dataflow_has_tables(dataflow: str) -> bool:
return len(ImfQueryBuilder().metadata.get_dataflow_hierarchies(dataflow)) > 0
if not dataflow_has_tables('DF'):
raise ValueError('no table presentation; query by dimensions instead') Type guard
def has_table_presentation(metadata, dataflow: str) -> bool:
return len(metadata.get_dataflow_hierarchies(dataflow)) > 0 Try / catch
try:
result = tb.get_table(dataflow=dataflow)
except ValueError as e:
if 'No tables/hierarchies found' in str(e):
url = ImfQueryBuilder().build_url(dataflow)
result = {'mode': 'dimension-query', 'data': ImfQueryBuilder().fetch_data(url)}
else:
raise Prevention
- Check get_dataflow_hierarchies(dataflow) before defaulting table_id to None.
- Fall back to direct dimension queries for flat dataflows.
- Refresh metadata cache before concluding a dataflow has no tables.
When it happens
Trigger: Calling get_table(dataflow='XYZ') for a flat dataflow without a hierarchical table presentation, or one whose hierarchy metadata failed to load.
Common situations: Using the table builder on dataflows designed for direct dimension queries, or stale metadata missing newly added hierarchies.
Related errors
- Invalid {name}(s): {', '.join(invalid)}
- Invalid indicator code(s) for dataflow '{dataflow}': {'; '.j
- Query string is empty or invalid -> '{query}'
- A query must be provided when no dataflows and keywords are
- No valid dataflows found to search indicators in.This might
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/af728fad1f4fa70f.
Report an issue: GitHub.