{"record":{"id":"debcc3d6dc0d98a2","repo":"OpenBB-finance/OpenBB","slug":"no-valid-countries-were-supplied-debcc3","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/economic_indicators.py","lineNumber":103,"sourceCode":"                    and c.upper() not in list(helpers.COUNTRY_MAP.values())\n                    and c.lower() != \"g7\"\n                ):\n                    country.remove(c)\n                elif len(c) == 3 and c.lower() != \"g20\":\n                    _c = helpers.THREE_LETTER_ISO_MAP.get(c.upper(), \"\")\n                    if _c:\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 helpers.COUNTRY_MAP:\n                    country[country.index(c)] = helpers.COUNTRY_MAP[c.lower()].upper()\n                elif len(c) > 2 and c.lower() in helpers.COUNTRY_GROUPS:\n                    country[country.index(c)] = \",\".join(\n                        helpers.COUNTRY_GROUPS[c.lower()]\n                    )\n            if len(country) == 0:\n                raise OpenBBError(\"No valid countries were supplied.\")\n            return \",\".join(country)\n        return None\n\n    @field_validator(\"symbol\", mode=\"before\", check_fields=False)\n    @classmethod\n    def validate_symbols(cls, v):\n        \"\"\"Validate each symbol to check if it is a valid indicator.\"\"\"\n        # pylint: disable=import-outside-toplevel\n        from openbb_econdb.utils import helpers\n\n        INDICATORS = list(helpers.INDICATORS_DESCRIPTIONS)\n        if not v:\n            v = \"main\"\n        symbols = v if isinstance(v, list) else v.split(\",\")\n        new_symbols: list[str] = []\n        for symbol in symbols:\n            if \"_\" in symbol:\n                new_symbols.append(symbol)","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/econdb/openbb_econdb/models/economic_indicators.py#L85-L121","documentation":"Same 'No valid countries were supplied' validation as in country_profile, but inside EconDbEconomicIndicatorsQueryParams' country validator: every supplied token failed to resolve via THREE_LETTER_ISO_MAP / COUNTRY_MAP / COUNTRY_GROUPS, warnings fired for the bad ones, and the normalized list came out empty.","triggerScenarios":"Calling obb.economy.indicator(provider='econdb', country=..., symbol=...) with country tokens like 'XX', 'ZZZ', or unmapped names. The validator returns only for non-None input, so this hits whenever the country parameter is provided but wholly invalid.","commonSituations":"Passing non-ISO or informal country strings; typo'd alpha-2 codes from user input or CSVs; assuming long names ('United States') are accepted when the map expects specific aliases.","solutions":["Use ISO alpha-2 ('us') or alpha-3 ('usa') codes, or group names in COUNTRY_GROUPS (e.g. 'g20').","Read the preceding warnings to see exactly which codes were dropped.","Pre-validate with openbb_econdb.utils.helpers.THREE_LETTER_ISO_MAP / COUNTRY_MAP before building the query.","Omit country entirely for indicators where you'll specify the country inline in the symbol (e.g. ' CPI~us')."],"exampleFix":"# before\nres = obb.economy.indicator(provider=\"econdb\", country=\"xx\", symbol=\"cpi\")\n\n# after\nres = obb.economy.indicator(provider=\"econdb\", country=\"us\", symbol=\"cpi\")","handlingStrategy":"validation","validationCode":"from openbb_econdb.utils.helpers import THREE_LETTER_ISO_MAP, COUNTRY_MAP, COUNTRY_GROUPS\n\ndef valid_country_tokens(tokens: list[str]) -> list[str]:\n    ok = []\n    for t in tokens:\n        k = t.lower()\n        if (len(t) == 2) or (len(t) == 3 and THREE_LETTER_ISO_MAP.get(t.upper())) or k in COUNTRY_MAP or k in COUNTRY_GROUPS:\n            ok.append(t)\n    return ok  # empty list => the API call would raise","typeGuard":null,"tryCatchPattern":"from openbb_core.provider.utils.errors import OpenBBError\ntry:\n    res = obb.economy.indicator(provider=\"econdb\", country=cs, symbol=s)\nexcept OpenBBError as e:\n    if \"No valid countries\" in str(e):\n        cs = prompt_for_valid_codes()\n        res = obb.economy.indicator(provider=\"econdb\", country=cs, symbol=s)\n    else:\n        raise","preventionTips":["Pre-validate codes against the provider's maps before building the query.","Use ISO alpha-2 codes; avoid informal country names."],"tags":["econdb","validation","country-codes","query-params"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}