OpenBB-finance/OpenBB · error · ValueError

Table indicators could not be mapped to dimension(s) {unmapp

Error message

Table indicators could not be mapped to dimension(s) {unmapped_indicator_dims}. The hierarchy's indicator codes are not compatible with dataflow '{dataflow}'. Hierarchy had codes from codelists: {list(codelist_to_dimension_cache.keys())}, but none matched the dataflow's indicator dimension.

What it means

Indicates a structural incompatibility: the indicator hierarchy loaded for a table carries codes from codelists (named in the message) that do not correspond to any indicator dimension (INDICATOR, BOP_ACCOUNTING_ENTRY, SERIES, ITEM) of the requested dataflow. The provider refuses to build the query rather than silently fetching wrong data.

Source

Thrown at openbb_platform/providers/imf/openbb_imf/utils/table_builder.py:670

                        )

            # If ALL indicator dimensions had zero matches, the hierarchy doesn't apply
            indicator_dims_set = {"INDICATOR", "BOP_ACCOUNTING_ENTRY", "SERIES", "ITEM"}
            missing_indicator_dims = [
                d for d in empty_dimensions if d in indicator_dims_set
            ]
            expected_indicator_dims = [
                d for d in dims_in_order if d in indicator_dims_set
            ]
            unmapped_indicator_dims = [
                d
                for d in expected_indicator_dims
                if d not in dimension_codes and d not in fetch_kwargs
            ]
            if unmapped_indicator_dims:
                # The hierarchy's indicator codes couldn't be mapped
                # this table doesn't work for this dataflow
                raise ValueError(
                    f"Table indicators could not be mapped to dimension(s) {unmapped_indicator_dims}. "
                    f"The hierarchy's indicator codes are not compatible with dataflow '{dataflow}'. "
                    f"Hierarchy had codes from codelists: {list(codelist_to_dimension_cache.keys())}, "
                    f"but none matched the dataflow's indicator dimension."
                )

            if missing_indicator_dims and not any(
                d in fetch_kwargs for d in indicator_dims_set
            ):
                # Use the same error format as query_builder validation
                for dim_id in missing_indicator_dims:
                    invalid_values = dimension_codes.get(dim_id, [])
                    # Get available values for this dimension
                    available_options = builder.get_options_for_dimension(dim_id)
                    available_values = sorted(  # type: ignore
                        {opt["value"] for opt in available_options}
                    )
                    # Build prior selections dict

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Use the correct dataflow for the table you are querying (check the dataflow name and table ID in IMF SDMX registry).
  2. Update the openbb-imf provider so its hierarchy-to-dimension mapping matches current IMF structures.
  3. Clear cached hierarchy/codelist files so they are rebuilt against the live dataflow.
  4. If the mapping should work, file an upstream issue including the dataflow name and the codelist names from the error.
Defensive patterns

Strategy: validation

Validate before calling

# Verify the table's codelists overlap the dataflow's indicator dimension before fetching
from openbb import obb
flows = obb.economy.imf.dataflows()  # inspect valid dataflow ids
assert my_dataflow in {f.dataflow for f in flows.results}, 'unknown/mismatched dataflow'

Try / catch

try:
    res = obb.economy.imf.fetch(dataset=dataflow, parameters=params)
except ValueError as e:
    if 'not compatible with dataflow' in str(e):
        # structural mismatch: switch dataflow or table, do not retry unchanged
        raise ConfigError(f'{table} incompatible with {dataflow}') from e
    raise

Prevention

When it happens

Trigger: Using a table/hierarchy designed for one IMF dataflow against another (e.g. a BOP hierarchy against the IFS dataflow), or after IMF renames codelists so the codelist_to_dimension cache maps to nothing. Detected by comparing expected indicator dims in dims_in_order against dimension_codes and fetch_kwargs.

Common situations: Hardcoding a table/database name in scripts that IMF later restructures; version skew between cached hierarchy JSON and current dataflow definitions; mixing parameters from documentation of a different dataset.

Related errors


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