OpenBB-finance/OpenBB · error · ValueError
Data structure not found for dataflow '{dataflow_id}'.
Error message
Data structure not found for dataflow '{dataflow_id}'. What it means
Raised by get_indicators_in when the dataflow exists but its structureRef.id is empty or the referenced Data Structure Definition (DSD) is absent from self.datastructures. This means the catalog loaded the dataflow entry but not the structure needed to enumerate indicator dimensions, so indicator discovery cannot proceed.
Source
Thrown at openbb_platform/providers/imf/openbb_imf/utils/metadata.py:809
with self._constraints_lock:
self._constraints_cache[cache_key] = result
return result
def get_indicators_in(self, dataflow_id: str) -> list:
"""Get indicators available in a given dataflow."""
if dataflow_id not in self.dataflows:
raise ValueError(f"Dataflow '{dataflow_id}' not found.")
dataflow_obj = self.dataflows[dataflow_id]
dataflow_name = dataflow_obj.get("name", "").replace("\\xa0", "").strip()
structure_ref = dataflow_obj.get("structureRef", {})
structure_id = structure_ref.get("id", "")
agency_id = dataflow_obj.get("agencyID", structure_ref.get("agencyID", "IMF"))
dsd_id = structure_ref.get("id", "")
if not dsd_id or dsd_id not in self.datastructures:
raise ValueError(f"Data structure not found for dataflow '{dataflow_id}'.")
dsd = self.datastructures[dsd_id]
all_dims = dsd.get("dimensions", [])
# Get valid codes from parameters API
try:
params = self.get_dataflow_parameters(dataflow_id)
except Exception: # noqa: BLE001
params = {}
full_indicator_list = []
indicator_id_candidates = [
"INDICATOR",
"PRODUCTION_INDEX",
"COICOP_1999",
"INDEX_TYPE",
"ACTIVITY",View on GitHub (pinned to 3e071fcc2c)
Solutions
- Refresh/re-download the structure metadata so self.datastructures includes the DSD referenced by the dataflow.
- Inspect meta.dataflows[dataflow_id]['structureRef'] to see which DSD id is being requested and whether it is empty.
- If structureRef.id is genuinely empty upstream, skip this dataflow and report it rather than retrying.
Example fix
# before
inds = meta.get_indicators_in(dataflow_id)
# after
dsd_id = meta.dataflows.get(dataflow_id, {}).get('structureRef', {}).get('id', '')
if not dsd_id or dsd_id not in meta.datastructures:
# re-fetch structures or pick another dataflow
...
inds = meta.get_indicators_in(dataflow_id) Defensive patterns
Strategy: validation
Validate before calling
ref = meta.dataflows.get(dataflow_id, {}).get('structureRef', {})
dsd_id = ref.get('id', '')
has_structure = bool(dsd_id) and dsd_id in meta.datastructures
if not has_structure:
print(f'DSD {dsd_id!r} missing for {dataflow_id}; refresh structures') Type guard
def dataflow_has_structure(meta, df_id: str) -> bool:
ref = meta.dataflows.get(df_id, {}).get('structureRef', {})
return bool(ref.get('id')) and ref['id'] in meta.datastructures Try / catch
try:
meta.get_indicators_in(df_id)
except ValueError as e:
if 'Data structure not found' in str(e):
# cache/consistency issue: refreshing metadata is the remedy, not retry-as-is
meta = reload_metadata()
else:
raise Prevention
- Treat dataflow.json and structure.json as an atomic pair when caching; refresh both together.
- Skip dataflows lacking structureRef.id during catalog crawls instead of letting them raise.
When it happens
Trigger: A dataflow whose JSON entry lacks 'structureRef.id'; a DSD id that is not present in the loaded datastructures cache (partial structure.json); agency-specific structures referenced but never fetched.
Common situations: Truncated or stale cached structure.json, new/renamed DSDs on the IMF side not yet in the local cache, dataflows maintained by agencies other than IMF whose structures use a different key.
Related errors
- Invalid {name}(s): {', '.join(invalid)}
- Invalid indicator code(s) for dataflow '{dataflow}': {'; '.j
- Dataflow '{dataflow_id}' not found.
- Dataflow '{dataflow_id}' not found. Available dataflows: {li
- Dimension '{dimension_id}' not found for dataflow '{self.dat
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/413f0ace5a8400a4.
Report an issue: GitHub.