{"record":{"id":"1c2bfd875c893913","repo":"OpenBB-finance/OpenBB","slug":"hierarchy-table-id-not-found-available-h","errorCode":null,"errorMessage":"Hierarchy '{table_id}' not found. Available: {[h['id'] for h in available_hierarchies]}","messagePattern":"Hierarchy '(.+?)' not found\\. Available: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/imf/openbb_imf/utils/metadata.py","lineNumber":1471,"sourceCode":"\n        if not available_hierarchies:\n            raise ValueError(\n                f\"No presentation hierarchies found for dataflow '{dataflow_id}'\"\n            )\n\n        # Track if this is a split table (one top-level code from a multi-code hierarchy)\n        top_level_code_filter: str | None = None\n        base_hierarchy_id: str | None = None\n\n        if table_id:\n            # Find the specific table\n            selected_table = None\n            for h in available_hierarchies:\n                if h[\"id\"] == table_id:\n                    selected_table = h\n                    break\n            if not selected_table:\n                raise ValueError(\n                    f\"Hierarchy '{table_id}' not found. \"\n                    f\"Available: {[h['id'] for h in available_hierarchies]}\"\n                )\n            # Check if this is a split table (format: \"base_id:top_level_code_id\")\n            if \":\" in table_id:\n                base_hierarchy_id, top_level_code_filter = table_id.split(\":\", 1)\n            else:\n                base_hierarchy_id = table_id\n        else:\n            selected_table = available_hierarchies[0]\n            table_id = selected_table.get(\"id\", \"\")\n            if table_id and \":\" in table_id:\n                base_hierarchy_id, top_level_code_filter = table_id.split(\":\", 1)\n            else:\n                base_hierarchy_id = table_id\n\n        # Handle hierarchy-based presentations\n        # Use base_hierarchy_id to look up the actual hierarchy object","sourceCodeStart":1453,"sourceCodeEnd":1489,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/imf/openbb_imf/utils/metadata.py#L1453-L1489","documentation":"Raised when an explicit table_id was passed to get_dataflow_hierarchy_table but none of the available hierarchy entries matches it by id. The message enumerates the valid ids, which may include 'split table' ids of the form 'base_id:top_level_code_id' — a common source of mismatch.","triggerScenarios":"Passing a bare hierarchy id when the available entries are split ids like 'HIER1:CODE_A' (or vice versa); passing an id obtained from a different/older catalog snapshot; case mismatches.","commonSituations":"Persisting table ids from an earlier session and reusing them after the IMF reorganized hierarchies; UI dropdowns populated from stale metadata; hand-typing ids from documentation.","solutions":["Read the 'Available:' list in the message and use one of those exact ids, including any ':code' suffix.","If you only know the base hierarchy id, call get_dataflow_hierarchies and search entries whose id starts with 'base_id:'.","Do not persist table ids long-term; re-resolve them each run from get_dataflow_hierarchies."],"exampleFix":"# before\ntable = meta.get_dataflow_hierarchy_table('FSIBSIS', table_id='HIER_X')\n\n# after\navail = {h['id'] for h in meta.get_dataflow_hierarchies('FSIBSIS')}\ntable_id = next((t for t in avail if t.split(':')[0] == 'HIER_X'), None)\ntable = meta.get_dataflow_hierarchy_table('FSIBSIS', table_id=table_id)","handlingStrategy":"validation","validationCode":"available = {h['id'] for h in meta.get_dataflow_hierarchies(df_id)}\nif table_id is not None and table_id not in available:\n    candidates = [t for t in available if t.split(':')[0] == table_id.split(':')[0]]\n    table_id = candidates[0] if candidates else None","typeGuard":null,"tryCatchPattern":"try:\n    meta.get_dataflow_hierarchy_table(df_id, table_id)\nexcept ValueError as e:\n    if 'Available:' in str(e):\n        # parse the printed list and re-select a valid id programmatically\n        valid = eval(str(e).split('Available:')[1].strip())\n        table_id = valid[0]\n    else:\n        raise","preventionTips":["Always source table ids from get_dataflow_hierarchies in the same session.","Remember split ids contain ':' — match on the prefix if unsure."],"tags":["imf","sdmx","hierarchy","validation","table-id"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}