OpenBB-finance/OpenBB · error · OpenBBError

Charting is not installed. Please install `openbb-charting`.

Error message

Charting is not installed. Please install `openbb-charting`.

What it means

Raised by the Direction-of-Trade query-params validator (shared by `country` and `counterpart` fields, mode='before') when the incoming value is falsy — None, empty string, or empty list. DOT queries are bilateral, so both a reporting country and a counterpart are mandatory. Fails at model construction before any IMF call.

Source

Thrown at openbb_platform/core/openbb_core/app/command_runner.py:269

        obbject = await maybe_coroutine(func, **kwargs)
        if isinstance(obbject, OBBject):
            obbject.provider = getattr(
                kwargs.get("provider_choices"),
                "provider",
                getattr(obbject, "provider", None),
            )
        return obbject

    @classmethod
    def _chart(
        cls,
        obbject: OBBject,
        **kwargs,
    ) -> None:
        """Create a chart from the command output."""
        try:
            if "charting" not in obbject.accessors:
                raise OpenBBError(
                    "Charting is not installed. Please install `openbb-charting`."
                )
            # Here we will pop the chart_params kwargs and flatten them into the kwargs.
            chart_params = {}
            extra_params = getattr(obbject, "_extra_params", {})

            if extra_params and "chart_params" in extra_params:
                chart_params = extra_params.get("chart_params", {})

            if kwargs.get("chart_params"):
                chart_params.update(kwargs.pop("chart_params", {}))
            # Verify that kwargs is not nested as kwargs so we don't miss any chart params.
            if (
                "kwargs" in kwargs
                and "chart_params" in kwargs["kwargs"]
                and kwargs["kwargs"].get("chart_params")
            ):
                chart_params.update(kwargs.pop("kwargs", {}).get("chart_params", {}))

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Pass both parameters, e.g. `country='USA', counterpart='W00'` (or '*' for all counterparts).
  2. If you want aggregates, use the supported wildcard `counterpart='all'` rather than omitting it.
  3. Add a truthiness check for both fields in your wrapper before calling the endpoint.

Example fix

# before
res = obb.economy.direction_of_trade(provider='imf', country='USA')

# after
res = obb.economy.direction_of_trade(provider='imf', country='USA', counterpart='W00')
Defensive patterns

Strategy: validation

Validate before calling

def validate_dot_params(country, counterpart):
    if not country or not counterpart:
        raise ValueError('IMF direction-of-trade requires non-empty country and counterpart.')

validate_dot_params(country, counterpart)

Type guard

def has_dot_pair(country, counterpart) -> bool:
    return bool(country) and bool(counterpart)

Prevention

When it happens

Trigger: Calling the DOT endpoint with `country=''` or omitted, or `counterpart=None`. Note this checks falsiness, not validity — a whitespace-only string like `' '` passes this guard and fails later in country resolution.

Common situations: Assuming DOT has a default counterpart (e.g. 'W00' world) when it requires one explicitly; blank form fields mapped to empty strings; programmatic loops where one iteration yields an empty code list.

Related errors


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