OpenBB-finance/OpenBB · error · ValueError

Invalid value(s) for dimension 'country': {invalid}. Given p

Error message

Invalid value(s) for dimension 'country': {invalid}. Given prior selections {{'indicator': '{','.join(indicator_codes)}'}}, available values are: {sorted(available_countries)}

What it means

Error "Invalid value(s) for dimension 'country': {invalid}. Given prior selections {{'indicator': '{','.join(indicator_codes)}'}}, available values are: {sorted(available_countries)}" thrown in OpenBB-finance/OpenBB.

Source

Thrown at openbb_platform/providers/imf/openbb_imf/models/economic_indicators.py:506

                "BOP_ACCOUNTING_ENTRY",
                "ACTIVITY",
            ]
            indicator_dim = next(
                (d for d in indicator_dim_candidates if d in dim_order), None
            )

            # Validate country
            if self.country and country_dim in dim_order:
                available_countries = get_available_values(country_dim, dataflow_id)
                if available_countries:
                    countries = [c.strip().upper() for c in self.country.split(",")]  # type: ignore  # pylint: disable=E1101
                    invalid = [
                        c
                        for c in countries
                        if c not in available_countries and c not in ("*", "all")
                    ]
                    if invalid:
                        raise ValueError(
                            f"Invalid value(s) for dimension 'country': {invalid}. "
                            + f"Given prior selections {{'indicator': '{','.join(indicator_codes)}'}}, "
                            + f"available values are: {sorted(available_countries)}"
                        )

            if (
                self.frequency
                and self.frequency.lower() not in ("all", "*")  # type: ignore  # pylint: disable=E1101
                and freq_dim in dim_order
            ):
                freq_map = {"annual": "A", "quarter": "Q", "month": "M", "day": "D"}
                freq_val = freq_map.get(str(self.frequency).lower(), self.frequency)
                available_freqs = get_available_values(freq_dim, dataflow_id)
                if available_freqs and freq_val not in available_freqs:
                    indicator_str = ",".join(indicator_codes)
                    raise ValueError(
                        f"Invalid value(s) for dimension 'frequency': ['{freq_val}']. "
                        f"Given prior selections {{'country': '{self.country}', "

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Choose country values from the listed available values for the selected indicators.
  2. Adjust the indicator selection if the desired countries are unavailable.

When it happens

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