OpenBB-finance/OpenBB · error · ValueError

dataflow is required. Either provide it directly or use tabl

Error message

dataflow is required. Either provide it directly or use table_id in 'dataflow_id::table_id' format.

What it means

get_table raises ValueError when no dataflow could be determined: neither dataflow was passed nor did table_id use the 'dataflow_id::table_id' format (which is the only way table_id alone carries the dataflow). Table lookup requires a dataflow context.

Source

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

        # pylint: disable=import-outside-toplevel
        from openbb_imf.utils.progressive_helper import ImfParamsBuilder

        # Parse dataflow_id::table_id format if provided
        if table_id and "::" in table_id:
            parts = table_id.split("::", 1)
            parsed_dataflow = parts[0]
            parsed_table_id = parts[1]
            # If dataflow was also provided, validate it matches
            if dataflow is not None and dataflow != parsed_dataflow:
                raise ValueError(
                    f"Dataflow mismatch: provided '{dataflow}' but table_id "
                    f"specifies '{parsed_dataflow}'. Use one or the other."
                )
            dataflow = parsed_dataflow
            table_id = parsed_table_id

        if dataflow is None:
            raise ValueError(
                "dataflow is required. Either provide it directly or use "
                "table_id in 'dataflow_id::table_id' format."
            )

        # Validate parameter combinations using progressive helper
        if kwargs or start_date or end_date:
            self._validate_dimension_constraints(
                dataflow, start_date=start_date, end_date=end_date, **kwargs
            )

        # If table_id not provided, auto-select if only one table available
        if table_id is None:
            available_tables = self.metadata.get_dataflow_hierarchies(dataflow)
            if len(available_tables) == 1:
                table_id = available_tables[0]["id"]
            elif len(available_tables) == 0:
                raise ValueError(
                    f"No tables/hierarchies found for dataflow '{dataflow}'"

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Prefix the table: table_id='BOP::H_BOP_BOP_AGG_STANDARD_PRESENTATION'.
  2. Or pass dataflow='BOP' alongside the bare table_id.
  3. List valid dataflows via ImfQueryBuilder().metadata.dataflows to find the right prefix.

Example fix

# before
result = tb.get_table(table_id='H_BOP_BOP_AGG_STANDARD_PRESENTATION')

# after
result = tb.get_table(table_id='BOP::H_BOP_BOP_AGG_STANDARD_PRESENTATION')
Defensive patterns

Strategy: validation

Validate before calling

def ensure_dataflow(dataflow: str | None, table_id: str | None) -> str:
    if dataflow:
        return dataflow
    if table_id and '::' in table_id:
        return table_id.split('::', 1)[0]
    raise ValueError('dataflow required: use table_id=FLOW::TABLE or pass dataflow=')

Try / catch

try:
    result = tb.get_table(table_id=table_id)
except ValueError as e:
    if 'dataflow is required' in str(e) and table_id:
        result = tb.get_table(table_id=f'{known_flow}::{table_id}')
    else:
        raise

Prevention

When it happens

Trigger: get_table(table_id='H_BOP_BOP_AGG_STANDARD_PRESENTATION') without the 'BOP::' prefix and without dataflow='BOP'; or both arguments None.

Common situations: Copy-pasting a bare hierarchy/table name from the IMF portal, or assuming table names are globally unique across dataflows.

Related errors


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