OpenBB-finance/OpenBB · error · ValueError

Required parameter for IMF provider not supplied.

Error message

Required parameter for IMF provider not supplied.

What it means

Error "Required parameter for IMF provider not supplied." thrown in OpenBB-finance/OpenBB.

Source

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

            "x-widget_config": {"value": "world", "style": {"popupWidth": 600}},
        },
    }

    limit: int | None = Field(
        default=None,
        description="Limit the number of results returned, the most recent data points first.",
    )

    @field_validator("country", "counterpart", mode="before")
    @classmethod
    def _validate_country_fields(cls, v):
        """Validate country and counterpart fields.

        Accepts both ISO3 codes (e.g., 'USA') and snake_case country names
        (e.g., 'united_states'). Converts names to ISO3 codes.
        """
        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."

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Supply the required parameters (country, counterpart, frequency) for the IMF direction of trade endpoint.
  2. Consult the endpoint documentation for required fields.

When it happens

Trigger: Thrown at openbb_platform/providers/imf/openbb_imf/models/direction_of_trade.py:60 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/a254c49d5277c129. Report an issue: GitHub.