OpenBB-finance/OpenBB · error · OpenBBError

The 'main' indicator cannot be combined with multiple countr

Error message

The 'main' indicator cannot be combined with multiple countries.

What it means

OpenBBError from EconDbEconomicIndicatorsFetcher.generate_query_params: the pseudo-indicator 'main' was combined with a country parameter containing more than one country. EconDB's main bundle is per-country, so the fetcher refuses instead of issuing a combinatorial request.

Source

Thrown at openbb_platform/providers/econdb/openbb_econdb/models/economic_indicators.py:178

    def transform_query(params: dict[str, Any]) -> EconDbEconomicIndicatorsQueryParams:
        """Transform the query parameters."""
        # pylint: disable=import-outside-toplevel
        from datetime import timedelta

        new_params = params.copy()
        if new_params.get("start_date") is None:
            new_params["start_date"] = (
                datetime.today() - timedelta(weeks=52 * 11)
            ).date()
        if new_params.get("end_date") is None:
            new_params["end_date"] = datetime.today().date()
        countries = new_params.get("country")
        if (
            countries is not None
            and len(countries.split(",")) > 1
            and new_params.get("symbol", "").upper() == "MAIN"
        ):
            raise OpenBBError(
                "The 'main' indicator cannot be combined with multiple countries."
            )
        return EconDbEconomicIndicatorsQueryParams(**new_params)

    @staticmethod
    async def aextract_data(  # pylint: disable=R0914.R0912,R0915
        query: EconDbEconomicIndicatorsQueryParams,
        credentials: dict[str, str] | None,
        **kwargs: Any,
    ) -> list[dict]:
        """Extract the data."""
        # pylint: disable=import-outside-toplevel
        from openbb_econdb.utils import helpers
        from openbb_econdb.utils.main_indicators import get_main_indicators

        if query.symbol.upper() == "MAIN":
            country = query.country.upper() if query.country else "US"

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Issue one call per country when symbol='main': loop ['us','de'] and pass a single code each time.
  2. Or drop 'main' and request specific indicators, which do support multi-country queries.
  3. Expand group aliases yourself before the call so each request has exactly one country.

Example fix

# before
res = obb.economy.indicator(provider="econdb", symbol="main", country="us,de")

# after
frames = [obb.economy.indicator(provider="econdb", symbol="main", country=c).to_df() for c in ("us", "de")]
Defensive patterns

Strategy: validation

Validate before calling

def is_main_query(symbol: str, country: str | None) -> bool:
    return symbol.upper() == "MAIN" and country is not None and len(country.split(",")) > 1
# loop per-country when true

Try / catch

from openbb_core.provider.utils.errors import OpenBBError
try:
    res = obb.economy.indicator(provider="econdb", symbol="main", country=cs)
except OpenBBError as e:
    if "multiple countries" in str(e):
        res = [obb.economy.indicator(provider="econdb", symbol="main", country=c) for c in cs.split(",")]
    else:
        raise

Prevention

When it happens

Trigger: Calling obb.economy.indicator(provider='econdb', symbol='main', country='us,de') or country='g20' (groups expand to multiple comma-joined countries and also trip the >1 check).

Common situations: Using 'g20' or 'eurozone' style group aliases together with symbol='main'; looping over countries and accidentally passing the full list string in one call.

Related errors


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