OpenBB-finance/OpenBB · error · OpenBBError

No valid countries were supplied.

Error message

No valid countries were supplied.

What it means

Identical logic to gdp_nominal: EconDbGdpRealFetcher's transform_query normalizes the country list and drops unmappable entries (3-letter codes missing from THREE_LETTER_ISO_MAP, names absent from COUNTRY_MAP/COUNTRY_GROUPS). If nothing survives, OpenBBError('No valid countries were supplied.') is raised before any request is made; each rejected code also emits a warning.

Source

Thrown at openbb_platform/providers/econdb/openbb_econdb/models/gdp_real.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 EconDbGdpRealData(GdpNominalData):
    """EconDB GDP Real Data."""

    real_growth_qoq: float = Field(
        description="Real GDP growth rate quarter over quarter.",
        json_schema_extra={"x-unit_measurement": "percent", "x-frontend_multiply": 100},
    )
    real_growth_yoy: float = Field(
        description="Real GDP growth rate year over year.",
        json_schema_extra={"x-unit_measurement": "percent", "x-frontend_multiply": 100},
    )
    value: int | float = Field(
        description="Real GDP value for the country and date.",
        json_schema_extra={"x-unit_measurement": "currency"},
    )

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Use 2-letter ISO codes ('us', 'de') which bypass mapping.
  2. Use underscore lowercase names from COUNTRY_MAP or a COUNTRY_GROUPS key like 'g20'.
  3. Run with warnings visible to see which entries were rejected.

Example fix

# before
obb.economy.gdp_real(provider='econdb', country='United States')

# after
obb.economy.gdp_real(provider='econdb', country='united_states')  # or 'us'
Defensive patterns

Strategy: validation

Validate before calling

from openbb_econdb.utils.helpers import COUNTRY_MAP, COUNTRY_GROUPS
valid = {c for c in COUNTRY_MAP} | set(COUNTRY_GROUPS) | {'g20'}
clean = [c for c in inputs if len(c) == 2 or c.lower() in valid]
if not clean:
    raise ValueError(f'no valid countries among {inputs}')

Prevention

When it happens

Trigger: economy.gdp_real(provider='econdb', country=...) where every entry fails normalization — bad 2-letter code, misspelled long name, unknown group.

Common situations: Same as nominal GDP: typos, wrong case for long names ('United States' vs 'united_states'), unsupported 3-letter ISO codes.

Related errors


AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14). Data as JSON: /api/errors/f967482ec0cc4fe1. Report an issue: GitHub.