OpenBB-finance/OpenBB · error · OpenBBError

Error mapping the provided choices to series ID. {','.join(m

Error message

Error mapping the provided choices to series ID.
{','.join(messages) if messages else ''}

What it means

Raised in FredBondIndicesQueryParams validation when the chosen index/category/index_type combination fails to map to any FRED series ID via BAML_CATEGORIES[category].get(index, {}).get(index_type) - all lookups returned nothing, so symbols is empty. Distinct from error 454: the index name passed its category check but has no series for the requested index_type (yield vs total_return).

Source

Thrown at openbb_platform/providers/fred/openbb_fred/models/bond_indices.py:524

        if "yield_curve" in values["index"]:
            maturities_dict = BAML_CATEGORIES[values["category"]][values["index"]]  # type: ignore
            maturities = list(maturities_dict)
            symbols = [
                maturities_dict[item][values["index_type"]] for item in maturities
            ]
        else:
            items = (
                values["index"]
                if isinstance(values["index"], list)
                else values["index"].split(",")
            )
            symbols = [
                BAML_CATEGORIES[values["category"]].get(item, {}).get(values["index_type"])  # type: ignore
                for item in items
            ]
            symbols = [symbol for symbol in symbols if symbol]
        if not symbols:
            raise OpenBBError(
                "Error mapping the provided choices to series ID."
                + f"\n{','.join(messages) if messages else ''}"
            )
        values["index"] = ",".join(new_index)
        new_params = FredBondIndicesQueryParams(**values)
        new_params._symbols = ",".join(symbols)  # pylint: disable=protected-access

        return new_params

    @staticmethod
    async def aextract_data(
        query: FredBondIndicesQueryParams,
        credentials: dict[str, str] | None,
        **kwargs: Any,
    ) -> dict:
        """Extract data."""
        api_key = credentials.get("fred_api_key") if credentials else ""
        series_ids = query._symbols  # pylint: disable=protected-access

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Inspect the BAML_CATEGORIES entry for your index in the module source to see which index_type keys it actually defines
  2. Switch index_type between 'total_return' and 'yield'
  3. Pick a different index within the category known to carry the desired index_type
  4. Read any appended validation messages for prior-stage context

Example fix

# before
res = await obb.economy.bond_indices(provider='fred', category='treasury', index='yield_curve', index_type='total_return').await_to_list()

# after
res = await obb.economy.bond_indices(provider='fred', category='treasury', index='yield_curve', index_type='yield').await_to_list()
Defensive patterns

Strategy: validation

Validate before calling

from openbb_fred.models.bond_indices import BAML_CATEGORIES
entry = BAML_CATEGORIES[category][index]
if not isinstance(entry, dict) or index_type not in (entry.values() if not isinstance(next(iter(entry.values()), None), dict) else next(iter(entry.values()))):
    raise ValueError(f'{index} has no {index_type} series')

Type guard

def has_index_type(index: str, category: str, index_type: str, categories: dict) -> bool:
    entry = categories.get(category, {}).get(index)
    if entry is None:
        return False
    if isinstance(next(iter(entry.values()), None), dict):
        return any(index_type in sub for sub in entry.values())
    return index_type in entry

Prevention

When it happens

Trigger: Requesting index_type='total_return' for an index that only has a yield series (or vice versa), or a yield_curve branch where the maturity->series mapping lacks the chosen index_type key.

Common situations: Assuming every BAML index has both yield and total_return variants; using index_type='yield' for indices defined only as total-return series in the BAML_CATEGORIES structure.

Related errors


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