OpenBB-finance/OpenBB · error · OpenBBError
No valid countries were supplied.
Error message
No valid countries were supplied.
What it means
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.
Source
Thrown at openbb_platform/providers/econdb/openbb_econdb/models/gdp_nominal.py:77
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 EconDbGdpNominalData(GdpNominalData):
"""EconDB GDP Nominal Data."""
nominal_growth_qoq: float = Field(
description="Nominal GDP growth rate quarter over quarter.",
json_schema_extra={"x-unit_measurement": "percent", "x-frontend_multiply": 100},
)
nominal_growth_yoy: float = Field(
description="Nominal GDP growth rate year over year.",
json_schema_extra={"x-unit_measurement": "percent", "x-frontend_multiply": 100},
)
value: int | float = Field(
description="Nominal GDP value for the country and date.",
json_schema_extra={"x-unit_measurement": "currency"},
)View on GitHub (pinned to 3e071fcc2c)
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.
Example fix
# before obb.economy.gdp_nominal(provider='econdb', country='USA') # may fail if 'USA' misses THREE_LETTER_ISO_MAP # after obb.economy.gdp_nominal(provider='econdb', country='us') # or 'united_states', or 'g20'
Defensive patterns
Strategy: validation
Validate before calling
from openbb_econdb.utils.helpers import COUNTRY_MAP, COUNTRY_GROUPS
from openbb_econdb.utils.helpers import THREE_LETTER_ISO_MAP # if exported; else validate against COUNTRY_MAP keys
def normalize(c: str) -> str | None:
c = c.lower()
if len(c) == 2 or c == 'g20':
return c
if len(c) == 3 and c != 'g20':
return THREE_LETTER_ISO_MAP.get(c.upper(), None)
if c in COUNTRY_MAP:
return COUNTRY_MAP[c].upper()
if c in COUNTRY_GROUPS:
return ','.join(COUNTRY_GROUPS[c])
return None
countries = [c for c in map(normalize, inputs) if c] Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- No valid countries were supplied.
- No valid countries were supplied.
- No valid countries were supplied.
- The 'main' indicator cannot be combined with multiple countr
- Invalid symbol: '{symbol}'. It must have a two-letter countr
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/0a03ce01d958f744.
Report an issue: GitHub.