OpenBB-finance/OpenBB · error · LoadingError

Error loading extension: {name} {e}

Error message

Error loading extension: {name}
{e}

What it means

Raised in the economic-indicators `atransform_data` when the query is in table mode (`_is_table` True) but `_dataflow` is falsy. `_dataflow` is set from the table symbol's prefix during model validation, so in practice this indicates inconsistent internal state — e.g. `_is_table` was set without going through `parse_and_validate_symbols`, or the attribute was mutated/reset afterward. Wrapped in OpenBBError, so it surfaces as a provider failure.

Source

Thrown at openbb_platform/core/openbb_core/app/router.py:531


class RouterLoader:
    """Router Loader."""

    @staticmethod
    @lru_cache
    def from_extensions() -> Router:
        """Load routes from extensions."""
        router = Router()

        for name, entry in ExtensionLoader().core_objects.items():  # type: ignore[attr-defined]
            try:
                router.include_router(router=entry, prefix=f"/{name}")
            except Exception as e:
                msg = f"Error loading extension: {name}\n"
                if Env().DEBUG_MODE:
                    traceback.print_exception(type(e), e, e.__traceback__)
                    raise LoadingError(msg + f"\033[91m{e}\033[0m") from e
                warnings.warn(
                    message=msg,
                    category=OpenBBWarning,
                )

        return router

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. If you construct the params object yourself, set `_dataflow` (the part before '::') whenever you set `_is_table=True`.
  2. Prefer going through the public router/endpoint so the model validator initializes private state correctly.
  3. Re-create the params object from scratch instead of mutating private attributes.

Example fix

# before (manual construction)
q = ImfEconomicIndicatorsQueryParams(symbol='STA::H_CPI', country='USA')
q._is_table = True  # _dataflow never set

# after
q = ImfEconomicIndicatorsQueryParams(symbol='STA::H_CPI', country='USA')  # validator sets both _is_table and _dataflow
Defensive patterns

Strategy: validation

Validate before calling

def validate_table_state(query) -> None:
    if getattr(query, '_is_table', False) and not getattr(query, '_dataflow', None):
        raise ValueError('Table mode requires _dataflow; construct via ImfEconomicIndicatorsQueryParams so the model validator sets it.')

validate_table_state(query)

Type guard

def is_consistent_table_query(query) -> bool:
    is_table = getattr(query, '_is_table', False)
    dataflow = getattr(query, '_dataflow', None)
    return (is_table and bool(dataflow)) or (not is_table)

Prevention

When it happens

Trigger: Constructing ImfEconomicIndicatorsQueryParams and flipping `_is_table` manually without setting `_dataflow`; pickling/deep-copying a params object where private attrs were dropped; subclassing or monkey-patching that interferes with the model validator. Normal calls through the router cannot hit it because the validator always sets both together.

Common situations: Library-internal misuse rather than a bad API call; tests that construct the params object and hand-set private fields; framework reloads (e.g. pytest fixtures) dropping underscore-prefixed attributes.

Related errors


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