OpenBB-finance/OpenBB · error · OpenBBError

TypeError: {te}. Check the data types in your results.

Error message

TypeError: {te}. Check the data types in your results.

What it means

Raised by the economic-indicators model validator when the parsed symbol list contains both tables (H_-prefixed identifiers or known hierarchy IDs) and plain indicators. The endpoint's table mode uses ImfTableBuilder against a single dataflow, which is a different code path from indicator mode, so mixing is unrepresentable in one request.

Source

Thrown at openbb_platform/core/openbb_core/app/model/obbject.py:279

                df.sort_index(axis=1, inplace=True)
            df = df.dropna(axis=1, how="all")

            # Sort by specified column
            if sort_by:
                df.sort_values(
                    by=sort_by,
                    ascending=ascending if ascending is not None else True,
                    inplace=True,
                )

        except OpenBBError as e:
            raise e
        except ValueError as ve:
            raise OpenBBError(
                f"ValueError: {ve}. Ensure the data format matches the expected format."
            ) from ve
        except TypeError as te:
            raise OpenBBError(
                f"TypeError: {te}. Check the data types in your results."
            ) from te
        except Exception as ex:
            raise OpenBBError(f"An unexpected error occurred: {ex}") from ex

        return df

    def to_polars(self) -> "PolarsDataFrame":  # type: ignore
        """Convert results field to polars dataframe."""
        try:
            from polars import from_pandas  # type: ignore # pylint: disable=import-outside-toplevel
        except ImportError as exc:
            raise ImportError(
                "Please install polars: `pip install polars pyarrow`  to use this method."
            ) from exc

        return from_pandas(self.to_dataframe(index=None))

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Split into two requests: one for the table, one for the indicator list.
  2. Keep H_-prefixed symbols in their own call — they always mean 'table'.
  3. When in doubt, resolve symbols via available_indicators()/list_tables() and group by type before calling.

Example fix

# before
res = obb.economy.economic_indicators(provider='imf', symbol='STA::H_CPI,IFS::NGDP_XDC', country='USA')

# after
table_res = obb.economy.economic_indicators(provider='imf', symbol='STA::H_CPI', country='USA')
ind_res = obb.economy.economic_indicators(provider='imf', symbol='IFS::NGDP_XDC', country='USA')
Defensive patterns

Strategy: validation

Validate before calling

def split_tables_and_indicators(symbol: str) -> tuple[list[str], list[str]]:
    tables, indicators = [], []
    for s in symbol.split(','):
        (tables if s.strip().split('::', 1)[1].startswith('H_') else indicators).append(s.strip())
    if tables and indicators:
        raise ValueError(f'Cannot mix tables {tables} with indicators {indicators}; issue separate requests.')
    return tables, indicators

tables, indicators = split_tables_and_indicators(symbol)

Type guard

def is_table_symbol(s: str) -> bool:
    _, sep, ident = s.strip().partition('::')
    return bool(sep) and ident.upper().startswith('H_')

Prevention

When it happens

Trigger: `symbol='ARGSDMX::H_CPI,IFS::NGDP_XDC'` (an H_ table plus an indicator), or a hierarchy ID (confirmed against the dataflow's hierarchy list) mixed with regular codes. Detection of hierarchy IDs requires a metadata lookup; if that lookup fails the token is assumed to be an indicator.

Common situations: Power users pasting a combined symbol list; batch jobs concatenating 'interesting things' lists; assuming one request can fetch a whole table plus extra series.

Related errors


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