OpenBB-finance/OpenBB · error · ValueError

Invalid series_type: {series} -> Valid options are: {valid_o

Error message

Invalid series_type: {series} -> Valid options are: {valid_options}

What it means

Pydantic field_validator error from FederalReserveSvenssonQueryParams: series_type was tokenized and lowercased, but at least one token is not in the SERIES_TYPE Literal options. The message interpolates the offending token and the valid tuple, so it tells you exactly which entry failed.

Source

Thrown at openbb_platform/providers/federal_reserve/openbb_federal_reserve/models/svensson_yield_curve.py:210

    @field_validator("series_type")
    @classmethod
    def _validate_series_type(cls, v):
        """Validate series_type field."""
        if not v:
            raise ValueError("series_type cannot be empty.")

        series_list = v.split(",") if isinstance(v, str) else v
        series_list = [v.strip().lower() for v in series_list]

        if "all" in series_list:
            return "all"

        valid_options = get_args(SERIES_TYPE)

        for series in series_list:
            if series not in valid_options:
                raise ValueError(
                    f"Invalid series_type: {series} -> Valid options are: {valid_options}"
                )

        return ",".join(series_list)


class FederalReserveSvenssonData(Data):
    """Federal Reserve Svensson Yield Curve Data.

    This data contains Nelson-Siegel-Svensson model parameters and derived yield curve estimates:
    - Zero-coupon yields (SVENY): Continuously compounded, 1-30 year maturities
    - Par yields (SVENPY): Coupon-equivalent, 1-30 year maturities
    - Instantaneous forward rates (SVENF): Continuously compounded, 1-30 year horizons
    - One-year forward rates (SVEN1F): Coupon-equivalent, at select horizons
    - Model parameters (BETA0-BETA3, TAU1-TAU2): Nelson-Siegel-Svensson coefficients

    Note: This is not an official Federal Reserve statistical release.
    Because this is a staff research product, it is subject to delay,

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Read the message: use one of the listed valid_options exactly, lowercase and underscore-separated.
  2. Use series_type='all' if you want every series.
  3. Programmatically intersect your desired list with the provider's Literal options before calling.

Example fix

from typing import get_args
from openbb_federal_reserve.models.svensson_yield_curve import SERIES_TYPE
# before
series = 'SVENPY,SVENY'
# after
wanted = [s.strip().lower() for s in series.split(',')]
valid = [s for s in wanted if s in get_args(SERIES_TYPE)] or ['all']
series = ','.join(valid)
Defensive patterns

Strategy: validation

Validate before calling

from typing import get_args
from openbb_federal_reserve.models.svensson_yield_curve import SERIES_TYPE
ok = [s for s in map(str.strip, raw.split(',')) if s.lower() in get_args(SERIES_TYPE)]
series = ','.join(ok) if ok else 'all'

Type guard

def is_valid_series(v: str) -> bool:
    from typing import get_args
    from openbb_federal_reserve.models.svensson_yield_curve import SERIES_TYPE
    return all(t.strip().lower() in get_args(SERIES_TYPE) for t in v.split(','))

Prevention

When it happens

Trigger: Passing series_type values like 'zero_coupon', 'svenpy', 'par yields' (typo, wrong name, spaces instead of underscores) or a mis-cased/renamed series after a provider upgrade changed SERIES_TYPE.

Common situations: Copy-pasting series names from FRED (SVENY/SVENPY) instead of the provider's option names; version upgrades that renamed valid options; trailing tokens after a comma.

Related errors


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