OpenBB-finance/OpenBB · error · OpenBBError
No valid countries were supplied.
Error message
No valid countries were supplied.
What it means
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.
Source
Thrown at openbb_platform/providers/econdb/openbb_econdb/models/country_profile.py:67
and c.upper() not in list(COUNTRY_MAP.values())
and c.lower() != "g7"
) or (
len(c) > 3 and c.lower() not in list(COUNTRY_MAP) + list(COUNTRY_GROUPS)
):
country.remove(c)
elif len(c) == 3 and c.lower() != "g20":
_c = THREE_LETTER_ISO_MAP.get(c.upper(), "")
if _c: # pylint: disable=R0801
country[country.index(c)] = _c
else:
warn(f"Error: {c} is not a valid country code.")
country.remove(c)
elif len(c) > 3 and c.lower() in COUNTRY_MAP:
country[country.index(c)] = COUNTRY_MAP[c.lower()].upper()
elif len(c) > 2 and c.lower() in COUNTRY_GROUPS:
country[country.index(c)] = ",".join(COUNTRY_GROUPS[c.lower()])
if len(country) == 0:
raise OpenBBError("No valid countries were supplied.")
return ",".join(country)
class EconDbCountryProfileData(CountryProfileData):
"""EconDB Country Profile Data."""
__alias_dict__ = {
"country": "Country",
"gdp_usd": "GDP ($B USD)",
"gdp_qoq": "GDP QoQ",
"gdp_yoy": "GDP YoY",
"cpi_yoy": "CPI YoY",
"core_yoy": "Core CPI YoY",
"retail_sales_yoy": "Retail Sales YoY",
"industrial_production_yoy": "Industrial Production YoY",
"policy_rate": "Policy Rate",
"yield_10y": "10Y Yield",
"govt_debt_gdp": "Govt Debt/GDP",View on GitHub (pinned to 3e071fcc2c)
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.
Example fix
# before profile = obb.economy.country_profile(provider="econdb", country="uk,zz") # both invalid -> raises # after profile = obb.economy.country_profile(provider="econdb", country="gb,US")
Defensive patterns
Strategy: validation
Validate before calling
from openbb_econdb.utils.helpers import THREE_LETTER_ISO_MAP, COUNTRY_MAP, COUNTRY_GROUPS
def sanitize_countries(countries: list[str]) -> list[str]:
out = []
for c in countries:
k = c.lower()
if len(c) == 2 and k != "":
out.append(c.upper())
elif len(c) == 3 and THREE_LETTER_ISO_MAP.get(c.upper()):
out.append(THREE_LETTER_ISO_MAP[c.upper()])
elif k in COUNTRY_MAP:
out.append(COUNTRY_MAP[k].upper())
elif k in COUNTRY_GROUPS:
out.extend(COUNTRY_GROUPS[k])
if not out:
raise ValueError(f"no valid countries in {countries}")
return out Try / catch
from openbb_core.provider.utils.errors import OpenBBError
try:
profile = obb.economy.country_profile(provider="econdb", country=",".join(cs))
except OpenBBError as e:
if "No valid countries" in str(e):
raise ValueError(f"sanitize input codes first: {cs}") from e
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- No valid countries were supplied.
- The 'main' indicator cannot be combined with other indicator
- The 'main' indicator cannot be combined with multiple countr
- Invalid symbol: '{symbol}'. It must have a two-letter countr
- No valid combination of indicator symbols and countries were
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/01223aa541be3134.
Report an issue: GitHub.