OpenBB-finance/OpenBB · error · ValueError

Error: No data to plot.

Error message

Error: No data to plot.

What it means

The fixed-income rate-curve chart builds its DataFrame from an injected DataFrame, a list/Data payload, or by dumping obbject_item records; if the resulting frame is empty, it raises ValueError('Error: No data to plot.'). An empty frame means every input path yielded zero rows — the provider returned no curve data for the requested parameters.

Source

Thrown at openbb_platform/extensions/fixedincome/openbb_fixedincome/fixedincome_views.py:44

        from openbb_charting.core.openbb_figure import OpenBBFigure
        from openbb_charting.styles.colors import LARGE_CYCLER
        from openbb_core.app.utils import basemodel_to_df
        from pandas import DataFrame

        data = kwargs.get("data")
        df: DataFrame = DataFrame()
        if data:
            if isinstance(data, DataFrame) and not data.empty:  # noqa: SIM108
                df = data
            elif isinstance(data, (list, Data)):
                df = basemodel_to_df(data, index=None)  # type: ignore
            else:
                pass
        else:
            df = DataFrame([d.model_dump() for d in kwargs["obbject_item"]])  # type: ignore

        if df.empty:
            raise ValueError("Error: No data to plot.")

        if "maturity" not in df.columns:
            raise ValueError("Error: Maturity column not found in the data.")

        if "rate" not in df.columns:
            raise ValueError("Error: Rate column not found in the data.")

        if "date" not in df.columns:
            raise ValueError("Error: Date column not found in the data.")

        provider = kwargs.get("provider")
        df["date"] = df["date"].astype(str)
        maturities = duration_sorter(df["maturity"].unique().tolist())
        countries: list = (
            df["country"].unique().tolist() if "country" in df.columns else []
        )

        # Use the supplied colors, if any.

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Inspect the raw response: res.to_df() — if empty, change provider/date/country.
  2. Use a supported date (business day) and a provider covering the requested market (e.g. provider='fred' for US).
  3. Ensure any injected data list is non-empty.

Example fix

# before
fig = obb.fixedincome.government.curve(date='2026-08-09', provider='fmp').charting.to_chart()  # Sunday

# after
fig = obb.fixedincome.government.curve(date='2026-08-07', provider='fmp').charting.to_chart()
Defensive patterns

Strategy: validation

Validate before calling

df = res.to_df() if hasattr(res, 'to_df') else DataFrame([d.model_dump() for d in data])
assert not df.empty, 'curve request returned no rows; adjust date/country/provider'

Type guard

def is_nonempty_frame(df) -> bool:
    """True when the converted curve frame has at least one row."""
    return df is not None and not df.empty

Try / catch

try:
    fig = views.fixedincome_curve(**kwargs)
except ValueError as e:
    if str(e) == 'Error: No data to plot.':
        kwargs['date'] = previous_business_day(kwargs['date'])
        fig = views.fixedincome_curve(**kwargs)
    else:
        raise

Prevention

When it happens

Trigger: Calling obb.fixedincome.government.curve(...).charting.to_chart() (fixedincome_views.py:44) for a date/country combination with no yield curve data; passing an empty list as data; provider error upstream swallowed into empty results.

Common situations: Requesting curves for unsupported countries or maturities, dates on weekends/holidays with no snapshot, or free-tier providers with limited history.

Related errors


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