{"record":{"id":"0a03ce01d958f744","repo":"OpenBB-finance/OpenBB","slug":"no-valid-countries-were-supplied-0a03ce","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/gdp_nominal.py","lineNumber":77,"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 EconDbGdpNominalData(GdpNominalData):\n    \"\"\"EconDB GDP Nominal Data.\"\"\"\n\n    nominal_growth_qoq: float = Field(\n        description=\"Nominal GDP growth rate quarter over quarter.\",\n        json_schema_extra={\"x-unit_measurement\": \"percent\", \"x-frontend_multiply\": 100},\n    )\n    nominal_growth_yoy: float = Field(\n        description=\"Nominal GDP growth rate year over year.\",\n        json_schema_extra={\"x-unit_measurement\": \"percent\", \"x-frontend_multiply\": 100},\n    )\n    value: int | float = Field(\n        description=\"Nominal GDP value for the country and date.\",\n        json_schema_extra={\"x-unit_measurement\": \"currency\"},\n    )","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/econdb/openbb_econdb/models/gdp_nominal.py#L59-L95","documentation":"EconDbGdpNominalFetcher's country normalization (economy/gdp_nominal.py) removes every supplied country that it cannot map: 3-letter codes not in THREE_LETTER_ISO_MAP are dropped, and strings that are neither 2-letter ISO codes, COUNTRY_MAP names, nor COUNTRY_GROUPS keys never match. If the list ends up empty, OpenBBError('No valid countries were supplied.') is raised before any network call.","triggerScenarios":"Calling economy.gdp_nominal(provider='econdb', country='ZZ' or country='usa' variants that miss the maps) where every entry fails normalization. Note each invalid code also emits a warnings.warn('Error: X is not a valid country code.') before the raise.","commonSituations":"Typos in country names ('unitedstates' instead of 'united_states'), unsupported 3-letter codes, passing a region name not present in COUNTRY_GROUPS, or case-sensitivity mistakes for names longer than 3 characters.","solutions":["Use 2-letter ISO codes (e.g. 'us', 'pt') — they pass through normalization directly.","For full names, use underscore form matching COUNTRY_MAP keys (e.g. 'united_states'), lowercase.","For groups, use a COUNTRY_GROUPS key such as 'g20'.","Capture warnings to see exactly which supplied codes were rejected."],"exampleFix":"# before\nobb.economy.gdp_nominal(provider='econdb', country='USA')  # may fail if 'USA' misses THREE_LETTER_ISO_MAP\n\n# after\nobb.economy.gdp_nominal(provider='econdb', country='us')  # or 'united_states', or 'g20'","handlingStrategy":"validation","validationCode":"from openbb_econdb.utils.helpers import COUNTRY_MAP, COUNTRY_GROUPS\nfrom openbb_econdb.utils.helpers import THREE_LETTER_ISO_MAP  # if exported; else validate against COUNTRY_MAP keys\n\ndef normalize(c: str) -> str | None:\n    c = c.lower()\n    if len(c) == 2 or c == 'g20':\n        return c\n    if len(c) == 3 and c != 'g20':\n        return THREE_LETTER_ISO_MAP.get(c.upper(), None)\n    if c in COUNTRY_MAP:\n        return COUNTRY_MAP[c].upper()\n    if c in COUNTRY_GROUPS:\n        return ','.join(COUNTRY_GROUPS[c])\n    return None\n\ncountries = [c for c in map(normalize, inputs) if c]","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize on 2-letter ISO codes in your pipeline.","Run normalization before calling the API and fail fast on None.","Keep warnings visible — they name each rejected code."],"tags":["validation","country-codes","gdp","econdb"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}