OpenBB-finance/OpenBB · warning · KeyError
Could not find an indicator-like dimension for dataflow '{da
Error message
Could not find an indicator-like dimension for dataflow '{dataflow_id}'. What it means
Raised as a KeyError by get_indicators_in when the DSD parsed successfully but no dimension qualified as 'indicator-like' (e.g. no ACTIVITY-style dimension with codes), so full_indicator_list stayed empty. It indicates a structural mismatch between the dataflow's dimensions and the heuristics this utility uses to identify indicator dimensions.
Source
Thrown at openbb_platform/providers/imf/openbb_imf/utils/metadata.py:918
activity_codelist_id, {}
)
for code_id, code_name in codes_map.items():
series_id = f"{dataflow_id}::{code_id}"
entry = {
"dataflow_id": dataflow_id,
"dataflow_name": dataflow_name,
"structure_id": structure_id,
"agency_id": agency_id,
"dimension_id": "ACTIVITY",
"indicator": code_id,
"label": code_name,
"description": descriptions_map.get(code_id, ""),
"series_id": series_id,
}
full_indicator_list.append(entry)
if not full_indicator_list:
raise KeyError(
f"Could not find an indicator-like dimension for dataflow '{dataflow_id}'."
)
return full_indicator_list
def _resolve_codelist_id(
self, dataflow_id: str, dsd_id: str | None, dim_id: str, dim_meta: dict
) -> str | None:
if not dim_id:
return None
# Check for explicit codelist reference first
representation = dim_meta.get("representation", {})
codelist_ref = representation.get("codelist")
if isinstance(codelist_ref, dict):
return codelist_ref.get("id")
if isinstance(codelist_ref, str):
return codelist_refView on GitHub (pinned to 3e071fcc2c)
Solutions
- Catch KeyError for this dataflow and skip it when iterating the full catalog — not every dataflow has indicators.
- Check the dataflow's dimension list (meta.datastructures[dsd_id]['dimensions']) to confirm no indicator dimension exists.
- Report/patch the heuristic in metadata.py if a legitimate indicator dimension (different id than ACTIVITY) is being missed.
Example fix
# before
for df_id in meta.dataflows:
indicators = meta.get_indicators_in(df_id) # KeyError on layout-less dataflows
# after
for df_id in meta.dataflows:
try:
indicators = meta.get_indicators_in(df_id)
except KeyError:
continue # dataflow has no indicator-like dimension Defensive patterns
Strategy: fallback
Validate before calling
def likely_has_indicators(meta, df_id: str) -> bool:
ref = meta.dataflows.get(df_id, {}).get('structureRef', {})
dsd = meta.datastructures.get(ref.get('id', ''), {})
return len(dsd.get('dimensions', [])) > 1 # heuristic: flat flows rarely expose indicators Try / catch
try:
indicators = meta.get_indicators_in(df_id)
except KeyError:
indicators = [] # dataflow layout unsupported: degrade gracefully in catalog crawls Prevention
- When iterating all dataflows, treat KeyError as 'skip' by design.
- Pin provider versions whose indicator heuristics match the IMF layout you depend on.
When it happens
Trigger: Dataflows whose dimensions are only frequency/region/time-style codes with no indicator codelist; codelist resolution failing for every candidate dimension (see _resolve_codelist_id); new dataflows published with an unfamiliar dimension layout.
Common situations: Exploratory scripts that iterate over every dataflow in the catalog and hit one with an unsupported layout; upstream IMF schema changes introducing new dataflow shapes; partial parameter-API responses swallowed by the 'except Exception' around get_dataflow_parameters.
Related errors
- Dataflow '{dataflow_id}' not found. Available dataflows: {li
- Dataflow '{dataflow}' not found.
- Extension '{ext_name}' is not installed.
- Invalid {name}(s): {', '.join(invalid)}
- Invalid indicator code(s) for dataflow '{dataflow}': {'; '.j
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/6f2028fb7f72dd08.
Report an issue: GitHub.