{"record":{"id":"af728fad1f4fa70f","repo":"OpenBB-finance/OpenBB","slug":"no-tables-hierarchies-found-for-dataflow-dataflo","errorCode":null,"errorMessage":"No tables/hierarchies found for dataflow '{dataflow}'","messagePattern":"No tables/hierarchies found for dataflow '(.+?)'","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/imf/openbb_imf/utils/table_builder.py","lineNumber":190,"sourceCode":"        if dataflow is None:\n            raise ValueError(\n                \"dataflow is required. Either provide it directly or use \"\n                \"table_id in 'dataflow_id::table_id' format.\"\n            )\n\n        # Validate parameter combinations using progressive helper\n        if kwargs or start_date or end_date:\n            self._validate_dimension_constraints(\n                dataflow, start_date=start_date, end_date=end_date, **kwargs\n            )\n\n        # If table_id not provided, auto-select if only one table available\n        if table_id is None:\n            available_tables = self.metadata.get_dataflow_hierarchies(dataflow)\n            if len(available_tables) == 1:\n                table_id = available_tables[0][\"id\"]\n            elif len(available_tables) == 0:\n                raise ValueError(\n                    f\"No tables/hierarchies found for dataflow '{dataflow}'\"\n                )\n\n        table_structure = self.metadata.get_dataflow_table_structure(dataflow, table_id)\n        table_metadata = {\n            \"hierarchy_id\": table_structure[\"hierarchy_id\"],\n            \"hierarchy_name\": table_structure[\"hierarchy_name\"],\n            \"hierarchy_description\": table_structure[\"hierarchy_description\"],\n            \"dataflow_id\": table_structure[\"dataflow_id\"],\n            \"codelist_id\": table_structure[\"codelist_id\"],\n            \"agency_id\": table_structure[\"agency_id\"],\n            \"version\": table_structure[\"version\"],\n            \"total_groups\": table_structure[\"total_groups\"],\n            \"type\": table_structure[\"type\"],\n        }\n        filtered_hierarchy_entries = table_structure[\"indicators\"]\n\n        if indicators is not None:","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/imf/openbb_imf/utils/table_builder.py#L172-L208","documentation":"When table_id is omitted, get_table auto-selects only if the dataflow exposes exactly one table hierarchy; zero hierarchies triggers ValueError. It means IMF metadata contains no presentation tables/hierarchies for this dataflow, so table-mode fetching is impossible.","triggerScenarios":"Calling get_table(dataflow='XYZ') for a flat dataflow without a hierarchical table presentation, or one whose hierarchy metadata failed to load.","commonSituations":"Using the table builder on dataflows designed for direct dimension queries, or stale metadata missing newly added hierarchies.","solutions":["Check metadata.get_dataflow_hierarchies(dataflow): if empty, this dataflow has no tables — use ImfQueryBuilder.build_url/fetch_data with dimensions instead.","Refresh cached metadata in case hierarchies exist upstream but not in cache.","Pass an explicit table_id if you know one exists from the IMF portal."],"exampleFix":"# before\nresult = tb.get_table(dataflow='FLAT_DATAFLOW')  # no hierarchies -> ValueError\n\n# after\nfrom openbb_imf.utils.query_builder import ImfQueryBuilder\nif ImfQueryBuilder().metadata.get_dataflow_hierarchies('FLAT_DATAFLOW'):\n    result = tb.get_table(dataflow='FLAT_DATAFLOW')\nelse:\n    df = ImfQueryBuilder().fetch_data(ImfQueryBuilder().build_url('FLAT_DATAFLOW'))","handlingStrategy":"type-guard","validationCode":"from openbb_imf.utils.query_builder import ImfQueryBuilder\n\ndef dataflow_has_tables(dataflow: str) -> bool:\n    return len(ImfQueryBuilder().metadata.get_dataflow_hierarchies(dataflow)) > 0\n\nif not dataflow_has_tables('DF'):\n    raise ValueError('no table presentation; query by dimensions instead')","typeGuard":"def has_table_presentation(metadata, dataflow: str) -> bool:\n    return len(metadata.get_dataflow_hierarchies(dataflow)) > 0","tryCatchPattern":"try:\n    result = tb.get_table(dataflow=dataflow)\nexcept ValueError as e:\n    if 'No tables/hierarchies found' in str(e):\n        url = ImfQueryBuilder().build_url(dataflow)\n        result = {'mode': 'dimension-query', 'data': ImfQueryBuilder().fetch_data(url)}\n    else:\n        raise","preventionTips":["Check get_dataflow_hierarchies(dataflow) before defaulting table_id to None.","Fall back to direct dimension queries for flat dataflows.","Refresh metadata cache before concluding a dataflow has no tables."],"tags":["validation","imf","metadata","table-builder","no-results"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}