OpenBB-finance/OpenBB · error · ValueError

Country '{v.name}' ({v.alpha_2}) is not supported by FMP. Va

Error message

Country '{v.name}' ({v.alpha_2}) is not supported by FMP. Valid options: {', '.join(sorted(valid_countries)[:20])}...

What it means

Error "Country '{v.name}' ({v.alpha_2}) is not supported by FMP. Valid options: {', '.join(sorted(valid_countries)[:20])}..." thrown in OpenBB-finance/OpenBB.

Source

Thrown at openbb_platform/providers/fmp/openbb_fmp/models/etf_search.py:62

        default=None,
    )
    country: Country | None = Field(
        default=None,
        description="Filter by country. Accepts ISO 3166-1 alpha-2 codes (e.g., 'US', 'DE'), "
        "alpha-3 codes (e.g., 'USA'), or country names (e.g., 'United States', 'united_states').",
    )

    @field_validator("country", mode="after")
    @classmethod
    def _validate_country(cls, v):
        """Validate country is supported by FMP."""
        if v is None:
            return v
        # Country stores alpha_2 in uppercase, FMP expects lowercase
        country_code = v.alpha_2.lower()
        valid_countries = list(Countries.__args__)
        if country_code not in valid_countries:
            raise ValueError(
                f"Country '{v.name}' ({v.alpha_2}) is not supported by FMP. "
                f"Valid options: {', '.join(sorted(valid_countries)[:20])}..."
            )
        return v


class FMPEtfSearchData(EtfSearchData):
    """FMP ETF Search Data."""

    model_config = ConfigDict(extra="ignore")

    __alias_dict__ = {
        "name": "companyName",
        "market_cap": "marketCap",
        "last_annual_dividend": "lastAnnualDividend",
        "exchange": "exchangeShortName",
        "exchange_name": "exchange",
    }

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Choose a country from the listed valid options supported by FMP.
  2. Pass the country as a supported ISO code or name; omit the parameter to search all countries.

When it happens

Trigger: Thrown at openbb_platform/providers/fmp/openbb_fmp/models/etf_search.py:62 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/0e38ad8d4e44fc23. Report an issue: GitHub.