{"record":{"id":"5e45bdb696429d8f","repo":"OpenBB-finance/OpenBB","slug":"error-no-data-to-plot-5e45bd","errorCode":null,"errorMessage":"Error: No data to plot.","messagePattern":"Error: No data to plot\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/extensions/fixedincome/openbb_fixedincome/fixedincome_views.py","lineNumber":44,"sourceCode":"        from openbb_charting.core.openbb_figure import OpenBBFigure\n        from openbb_charting.styles.colors import LARGE_CYCLER\n        from openbb_core.app.utils import basemodel_to_df\n        from pandas import DataFrame\n\n        data = kwargs.get(\"data\")\n        df: DataFrame = DataFrame()\n        if data:\n            if isinstance(data, DataFrame) and not data.empty:  # noqa: SIM108\n                df = data\n            elif isinstance(data, (list, Data)):\n                df = basemodel_to_df(data, index=None)  # type: ignore\n            else:\n                pass\n        else:\n            df = DataFrame([d.model_dump() for d in kwargs[\"obbject_item\"]])  # type: ignore\n\n        if df.empty:\n            raise ValueError(\"Error: No data to plot.\")\n\n        if \"maturity\" not in df.columns:\n            raise ValueError(\"Error: Maturity column not found in the data.\")\n\n        if \"rate\" not in df.columns:\n            raise ValueError(\"Error: Rate column not found in the data.\")\n\n        if \"date\" not in df.columns:\n            raise ValueError(\"Error: Date column not found in the data.\")\n\n        provider = kwargs.get(\"provider\")\n        df[\"date\"] = df[\"date\"].astype(str)\n        maturities = duration_sorter(df[\"maturity\"].unique().tolist())\n        countries: list = (\n            df[\"country\"].unique().tolist() if \"country\" in df.columns else []\n        )\n\n        # Use the supplied colors, if any.","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/extensions/fixedincome/openbb_fixedincome/fixedincome_views.py#L26-L62","documentation":"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.","triggerScenarios":"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.","commonSituations":"Requesting curves for unsupported countries or maturities, dates on weekends/holidays with no snapshot, or free-tier providers with limited history.","solutions":["Inspect the raw response: res.to_df() — if empty, change provider/date/country.","Use a supported date (business day) and a provider covering the requested market (e.g. provider='fred' for US).","Ensure any injected data list is non-empty."],"exampleFix":"# before\nfig = obb.fixedincome.government.curve(date='2026-08-09', provider='fmp').charting.to_chart()  # Sunday\n\n# after\nfig = obb.fixedincome.government.curve(date='2026-08-07', provider='fmp').charting.to_chart()","handlingStrategy":"validation","validationCode":"df = res.to_df() if hasattr(res, 'to_df') else DataFrame([d.model_dump() for d in data])\nassert not df.empty, 'curve request returned no rows; adjust date/country/provider'","typeGuard":"def is_nonempty_frame(df) -> bool:\n    \"\"\"True when the converted curve frame has at least one row.\"\"\"\n    return df is not None and not df.empty","tryCatchPattern":"try:\n    fig = views.fixedincome_curve(**kwargs)\nexcept ValueError as e:\n    if str(e) == 'Error: No data to plot.':\n        kwargs['date'] = previous_business_day(kwargs['date'])\n        fig = views.fixedincome_curve(**kwargs)\n    else:\n        raise","preventionTips":["Assert non-empty results after the curve request.","Use business days for date-parameterized curve snapshots.","Keep a fallback provider for thin markets."],"tags":["fixedincome","charting","empty-data","yield-curve"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}