{"record":{"id":"01223aa541be3134","repo":"OpenBB-finance/OpenBB","slug":"no-valid-countries-were-supplied","errorCode":null,"errorMessage":"No valid countries were supplied.","messagePattern":"No valid countries were supplied\\.","errorType":"validation","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/econdb/openbb_econdb/models/country_profile.py","lineNumber":67,"sourceCode":"                and c.upper() not in list(COUNTRY_MAP.values())\n                and c.lower() != \"g7\"\n            ) or (\n                len(c) > 3 and c.lower() not in list(COUNTRY_MAP) + list(COUNTRY_GROUPS)\n            ):\n                country.remove(c)\n            elif len(c) == 3 and c.lower() != \"g20\":\n                _c = THREE_LETTER_ISO_MAP.get(c.upper(), \"\")\n                if _c:  # pylint: disable=R0801\n                    country[country.index(c)] = _c\n                else:\n                    warn(f\"Error: {c} is not a valid country code.\")\n                    country.remove(c)\n            elif len(c) > 3 and c.lower() in COUNTRY_MAP:\n                country[country.index(c)] = COUNTRY_MAP[c.lower()].upper()\n            elif len(c) > 2 and c.lower() in COUNTRY_GROUPS:\n                country[country.index(c)] = \",\".join(COUNTRY_GROUPS[c.lower()])\n        if len(country) == 0:\n            raise OpenBBError(\"No valid countries were supplied.\")\n        return \",\".join(country)\n\n\nclass EconDbCountryProfileData(CountryProfileData):\n    \"\"\"EconDB Country Profile Data.\"\"\"\n\n    __alias_dict__ = {\n        \"country\": \"Country\",\n        \"gdp_usd\": \"GDP ($B USD)\",\n        \"gdp_qoq\": \"GDP QoQ\",\n        \"gdp_yoy\": \"GDP YoY\",\n        \"cpi_yoy\": \"CPI YoY\",\n        \"core_yoy\": \"Core CPI YoY\",\n        \"retail_sales_yoy\": \"Retail Sales YoY\",\n        \"industrial_production_yoy\": \"Industrial Production YoY\",\n        \"policy_rate\": \"Policy Rate\",\n        \"yield_10y\": \"10Y Yield\",\n        \"govt_debt_gdp\": \"Govt Debt/GDP\",","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/econdb/openbb_econdb/models/country_profile.py#L49-L85","documentation":"OpenBBError from EconDbCountryProfileQueryParams country validation: every supplied country token was removed during normalization, leaving an empty list. Codes that are 2-letter non-ISO, unknown 3-letter codes (warn + remove), or un-mappable names all drop out; only G20 and known groups/names survive.","triggerScenarios":"Calling obb.economy.country_profile(provider='econdb', country=...) where country is e.g. 'XX' (invalid 2-letter), 'ZZZ' (unknown 3-letter), or a name not in COUNTRY_MAP. Each invalid token emits a warning and is removed; if all are invalid the list is empty and this raises.","commonSituations":"Passing made-up or uppercase-full-name codes not in the provider's map; passing 'uk' expecting ISO 'gb'; datasets with typo'd ISO codes feeding the parameter; mixing several codes where all happen to be invalid.","solutions":["Use ISO-3166 alpha-2 or alpha-3 codes (e.g. 'US', 'USA', 'DEU') or group names like 'g20' supported by the provider.","Check the emitted warnings — each one names the invalid code that was dropped; fix those tokens.","Pre-validate against helpers THREE_LETTER_ISO_MAP / COUNTRY_MAP in openbb_econdb.utils.helpers before calling.","If you need UK-style aliases, map them yourself first (uk->gb) since the provider does not."],"exampleFix":"# before\nprofile = obb.economy.country_profile(provider=\"econdb\", country=\"uk,zz\")  # both invalid -> raises\n\n# after\nprofile = obb.economy.country_profile(provider=\"econdb\", country=\"gb,US\")","handlingStrategy":"validation","validationCode":"from openbb_econdb.utils.helpers import THREE_LETTER_ISO_MAP, COUNTRY_MAP, COUNTRY_GROUPS\n\ndef sanitize_countries(countries: list[str]) -> list[str]:\n    out = []\n    for c in countries:\n        k = c.lower()\n        if len(c) == 2 and k != \"\":\n            out.append(c.upper())\n        elif len(c) == 3 and THREE_LETTER_ISO_MAP.get(c.upper()):\n            out.append(THREE_LETTER_ISO_MAP[c.upper()])\n        elif k in COUNTRY_MAP:\n            out.append(COUNTRY_MAP[k].upper())\n        elif k in COUNTRY_GROUPS:\n            out.extend(COUNTRY_GROUPS[k])\n    if not out:\n        raise ValueError(f\"no valid countries in {countries}\")\n    return out","typeGuard":null,"tryCatchPattern":"from openbb_core.provider.utils.errors import OpenBBError\ntry:\n    profile = obb.economy.country_profile(provider=\"econdb\", country=\",\".join(cs))\nexcept OpenBBError as e:\n    if \"No valid countries\" in str(e):\n        raise ValueError(f\"sanitize input codes first: {cs}\") from e\n    raise","preventionTips":["Send ISO alpha-2/alpha-3 codes only; map informal aliases ('uk'->'gb') client-side.","Watch for per-code warnings — they name each dropped code before the fatal raise."],"tags":["econdb","validation","country-codes","iso-3166","query-params"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}