OpenBB-finance/OpenBB · error · OpenBBError

Indicator {symbol} does not have countries.

Error message

Indicator {symbol} does not have countries.

What it means

parse_symbols in openbb_econdb.utils.helpers raises OpenBBError when a countries argument is supplied for an indicator whose entry in the HAS_COUNTRIES map is not True — i.e. the EconDB ticker does not accept a country suffix (symbols like CPIAU do, single-country series like GDPUS do not). This guards against constructing invalid tickers such as 'GDPUS~US'.

Source

Thrown at openbb_platform/providers/econdb/openbb_econdb/utils/helpers.py:351

    "Uzbekistan",
    "Kazakhstan",
    "Bosnia And Herzegovina",
]


def parse_symbols(
    symbol,
    transform: str | None = None,
    countries: str | list[str] | None = None,
):
    """Parse the indicator symbol with the optional transformation for a list of countries. Returns a string list."""
    symbols = []
    if not countries:
        if transform:
            symbol += "~" + transform
        symbols.append(symbol)
    elif countries and HAS_COUNTRIES.get(symbol, False) is False:
        raise OpenBBError(f"Indicator {symbol} does not have countries.")
    elif countries and HAS_COUNTRIES.get(symbol, False) is True:
        countries = countries if isinstance(countries, list) else countries.split(",")
        for country in countries:
            new_country = (
                "EA19"
                if country == "EA" and (symbol in ["URATE", "POP", "GDEBT"])
                else country
            )
            new_symbol = symbol + new_country
            if transform:
                new_symbol += "~" + transform
            symbols.append(new_symbol)

    return ",".join(symbols)


def unit_multiplier(unit: str) -> int:  # pylint: disable=R0911
    """Return the multiplier for a given unit measurement."""

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Drop the countries argument for that symbol and request the country-specific ticker directly.
  2. Check helpers.get_indicator_countries(symbol) / HAS_COUNTRIES to see which indicators accept countries.
  3. Use a country-parameterized indicator (e.g. 'CPIAU' or 'URATE') when you need multi-country queries.

Example fix

# before
symbols = parse_symbols('GDP', transform='pct_change', countries='us,de')  # raises

# after - request country-specific tickers directly
symbols = 'GDPUS,GDPDE'  # or use a country-parameterized indicator:
symbols = parse_symbols('URATE', transform='pct_change', countries='us,de')
Defensive patterns

Strategy: type-guard

Validate before calling

from openbb_econdb.utils.helpers import HAS_COUNTRIES, get_indicator_countries
if countries and not HAS_COUNTRIES.get(symbol, False):
    raise ValueError(f'{symbol} does not take countries; use a country-specific ticker')

Type guard

def indicator_takes_countries(symbol: str) -> bool:
    from openbb_econdb.utils.helpers import HAS_COUNTRIES
    return HAS_COUNTRIES.get(symbol, False) is True

Try / catch

from openbb_core.app.model.obbject import OpenBBError
try:
    symbols = parse_symbols(sym, transform=t, countries=cs)
except OpenBBError as e:
    if 'does not have countries' in str(e):
        symbols = sym  # fall back to the bare ticker
    else:
        raise

Prevention

When it happens

Trigger: Calling an econdb-sourced endpoint (economy.econbibulk or internal helpers using parse_symbols) with both symbol='GDP' style indicator and countries='us' where that symbol is not country-parameterized in HAS_COUNTRIES.

Common situations: Assuming every indicator is country-suffixed; mixing up tickers that already embed a country with those that take one; stale HAS_COUNTRIES map after EconDB adds/removes parameterized series.

Related errors


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