OpenBB-finance/OpenBB · error · ValueError

series_type cannot be empty.

Error message

series_type cannot be empty.

What it means

A Pydantic field_validator error from FederalReserveSvenssonQueryParams: the series_type parameter was falsy — empty string, empty list, or None after defaults — so validation fails before any network call. It exists to force the caller to explicitly pick which Svensson series (or 'all') to request.

Source

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

        "Used to filter columns after fetching.",
    )
    start_date: dateType | None = Field(
        default=None,
        description=QUERY_DESCRIPTIONS.get("start_date", "")
        + " Used to filter results after fetching.",
    )
    end_date: dateType | None = Field(
        default=None,
        description=QUERY_DESCRIPTIONS.get("end_date", "")
        + " Used to filter results after fetching.",
    )

    @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)

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Pass a valid value: 'all' or a comma-separated subset of the SERIES_TYPE options (e.g. 'zero_coupon_yields,par_yields').
  2. If the field is optional in your UI, default it to 'all' before calling the API.
  3. Validate non-empty input client-side before constructing the QueryParams.

Example fix

// before
params = FederalReserveSvenssonQueryParams(series_type=user_input)  # user_input = ''
// after
params = FederalReserveSvenssonQueryParams(series_type=user_input or 'all')
Defensive patterns

Strategy: validation

Validate before calling

series_type = (series_type or '').strip() or 'all'
params = FederalReserveSvenssonQueryParams(series_type=series_type)

Type guard

def is_valid_series_input(v) -> bool:
    return bool(v and v.strip())

Try / catch

try:
    FederalReserveSvenssonQueryParams(series_type=s)
except ValidationError as e:
    s = 'all'

Prevention

When it happens

Trigger: Instantiating FederalReserveSvenssonQueryParams (or obb.economy.svensson_yield_curve) with series_type='' or omitting it while a wrapper overwrites it with an empty value; passing an empty list programmatically.

Common situations: Programmatic callers building params from user input where the series_type field is left blank; a wrapper defaulting the field to '' instead of 'all'.

Related errors


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