OpenBB-finance/OpenBB · error · ValueError

'all' cannot be used with other country codes in a list.

Error message

'all' cannot be used with other country codes in a list.

What it means

Error "'all' cannot be used with other country codes in a list." thrown in OpenBB-finance/OpenBB.

Source

Thrown at openbb_platform/providers/imf/openbb_imf/models/direction_of_trade.py:77

        if not v:
            raise ValueError("Required parameter for IMF provider not supplied.")

        if isinstance(v, str) and v.lower() in ["all", "*"]:
            return "*"

        # Split by comma if string
        values = (
            v.split(",")
            if isinstance(v, str) and "," in v
            else [v] if isinstance(v, str) else v
        )

        result: list[str] = []
        for item in values:
            item_stripped = item.strip()
            if item_stripped.lower() in ["all", "*"]:
                if len(values) > 1:
                    raise ValueError(
                        "'all' cannot be used with other country codes in a list."
                    )
                return "*"
            # Resolve the country input (handles both codes and names)
            resolved = resolve_country_input(item_stripped)
            result.append(resolved)

        return ",".join(result)


class ImfDirectionOfTradeData(DirectionOfTradeData):
    """IMF Direction Of Trade Data."""

    model_config = ConfigDict(extra="ignore")
    __alias_dict__ = {
        "date": "TIME_PERIOD",
        "symbol": "series_id",
        "country": "COUNTRY",

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Use 'all' alone, not combined with other country codes.
  2. Or remove 'all' and list specific country codes.

When it happens

Trigger: Thrown at openbb_platform/providers/imf/openbb_imf/models/direction_of_trade.py:77 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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