OpenBB-finance/OpenBB · error · ValueError
No valid indicator codes found after filtering and dimension
Error message
No valid indicator codes found after filtering and dimension mapping. Filtered entries: {len(entries_with_codes)} What it means
Thrown by the IMF SDMX table builder when, after walking the indicator hierarchy and filtering entries against codelist/dimension mappings, not a single indicator code could be assigned to any dimension. It means the fetched hierarchy contained entries, but none survived filtering (wrong codelist, unmapped codes, or depth filtering), so no data URL can be constructed.
Source
Thrown at openbb_platform/providers/imf/openbb_imf/utils/table_builder.py:337
if not dimension_id:
warnings.warn(
f"Could not map codelist {codelist_id} to dimension for dataflow {dataflow}",
OpenBBWarning,
)
continue
# Add code to the appropriate dimension
if indicator_code not in dimension_codes[dimension_id]:
dimension_codes[dimension_id].append(indicator_code)
# Track depth for constraint URL length optimization
code_depth = entry.get("depth", 0)
dimension_codes_with_depth[dimension_id].append(
(indicator_code, code_depth)
)
if not dimension_codes:
raise ValueError(
f"No valid indicator codes found after filtering and dimension mapping. "
f"Filtered entries: {len(entries_with_codes)}"
)
hierarchy_order_map = {}
hierarchy_by_series_id = {}
hierarchy_by_sorted_codes = {}
# Some hierarchies can legitimately contain multiple nodes with the same
# (indicator_code, parent_code) (e.g., BOP Credit vs Debit variants under a Net parent),
# so store a list and disambiguate later.
# Key: (indicator_code, parent_code) e.g., ("O", "A_P") vs ("O", "L_P")
hierarchy_by_composite_key: dict[tuple[str, str], list[dict]] = defaultdict(
list
)
parents_by_indicator_code: dict[str, set[str]] = defaultdict(set)
# Build indicator_by_code lookup for depth calculation
indicator_by_code = {}View on GitHub (pinned to 3e071fcc2c)
Solutions
- Update/refresh the IMF provider package so hierarchy parsing matches current IMF codelists (pip install -U openbb-imf).
- Clear any cached IMF hierarchy/codelist data so fresh metadata is fetched and re-mapped.
- Verify you are querying the correct dataflow/table combination for the indicators you want (e.g. BOP vs IFS tables).
- If it persists, inspect openbb_imf/utils/table_builder.py dimension mapping for the specific dataflow and report the dataflow + table ID as an upstream bug.
Defensive patterns
Strategy: validation
Validate before calling
# Before fetching, confirm the table's hierarchy yields mappable indicator codes
from openbb import obb
codelists = obb.economy.imf.codelists(dataset='BOP') # discover current mapping
if not codelists.results:
raise RuntimeError('IMF codelist metadata unavailable - do not fetch; '
'this is the precondition that produces the 'No valid indicator codes' error') Try / catch
try:
res = obb.economy.imf.fetch(dataset='...', parameters={...})
except ValueError as e:
if 'No valid indicator codes found' in str(e):
# metadata/hierarchy problem, not user input - refresh caches, then retry once
obb.economy.imf.slash_refresh_cache() if hasattr(obb.economy.imf, 'slash_refresh_cache') else None
raise Prevention
- Refresh IMF metadata/codelists before batch jobs
- Pin an openbb-imf version validated against current IMF SDMX structures
- Log the dataflow + table ID with every fetch so failures are reproducible
When it happens
Trigger: Calling an IMF dataflow fetch (e.g. economic/imf fetch with a table/hierarchy-driven dataflow) where the hierarchy file's indicator codes do not map onto any dimension of the dataflow, or all entries lack usable indicator codes after codelist filtering. Occurs inside build_fetch_kwargs/table construction before any HTTP data request is finalized.
Common situations: IMF changes or renames SDMX codelists; the cached hierarchy is stale; user supplies a table whose indicators belong to a different dataflow; upstream dimension-mapping cache (codelist_to_dimension) is empty because a prior metadata request failed silently.
Related errors
- Table indicators could not be mapped to dimension(s) {unmapp
- Please install polars: `pip install polars pyarrow` to use
- Chart not found.
- Invalid logging handler
- Extension '{ext_name}' is not installed.
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/02a51575db16b2d0.
Report an issue: GitHub.