{"record":{"id":"e352b453f68138fd","repo":"OpenBB-finance/OpenBB","slug":"no-data-found-to-plot","errorCode":null,"errorMessage":"No data found to plot.","messagePattern":"No data found to plot\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"openbb_platform/extensions/economy/openbb_economy/economy_views.py","lineNumber":379,"sourceCode":"            )\n\n        _data = (\n            kwargs.pop(\"data\", None)\n            if \"data\" in kwargs and kwargs[\"data\"] is not None\n            else kwargs.get(\"obbject_item\")\n        )\n        df = DataFrame()\n\n        if isinstance(_data, DataFrame) and not _data.empty:\n            df = _data.reset_index() if _data.index.name == \"date\" else _data\n        else:\n            try:\n                df = basemodel_to_df(_data, index=None)  # type: ignore\n            except Exception as e:\n                raise RuntimeError(\"Unable to process supplied data.\") from e\n\n        if df.empty or len(df) < 2:\n            raise RuntimeError(\"No data found to plot.\")\n\n        cols = df.columns.to_list()\n        target_col = kwargs.get(\"target_col\", \"value\")\n        if target_col not in cols:\n            raise RuntimeError(f\"Column '{target_col}' not found in the data.\")\n\n        new_df = df.pivot(columns=\"symbol\", values=target_col, index=\"date\")\n        target_symbols = kwargs.get(\"target_symbol\", \"\").split(\",\")[:10]  # type: ignore\n\n        if not target_symbols or len(target_symbols) == 0 or target_symbols[0] == \"\":\n            target_symbols = new_df.columns.to_list()[:10]\n\n        metadata = kwargs[\"extra\"].get(\"results_metadata\", {})  # type: ignore\n        ytitle = kwargs.get(\"ytitle\", \"\")\n\n        new_df = new_df.filter(target_symbols, axis=1)\n\n        if \"percent\" in target_col.lower():  # type: ignore","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/extensions/economy/openbb_economy/economy_views.py#L361-L397","documentation":"After converting the input to a DataFrame, the BLS charting view requires at least 2 rows to draw a line/bar chart; an empty frame or a single observation raises RuntimeError('No data found to plot.'). This is a data-sufficiency guard, not a conversion failure — the data parsed fine but is too sparse to visualize.","triggerScenarios":"Charting a BLS series request that returned 0 or 1 records; a date range/filter so narrow only one period survives; passing data= with a one-row DataFrame.","commonSituations":"Requesting very recent start dates for series published monthly/quarterly with a lag, provider outages returning single rows, or slicing a DataFrame to the latest observation before charting.","solutions":["Check the row count before charting: len(res.to_df()) >= 2.","Widen the date range (start_date earlier) or drop restrictive filters so at least 2 periods exist.","Verify the series id actually has data for the requested window (res.to_df().head())."],"exampleFix":"# before\nfig = obb.economy.bls.multiple_series(symbols=['LNS14000000'], start_date='2026-08-01', provider='bls').charting.bls()  # 0-1 rows\n\n# after\nfig = obb.economy.bls.multiple_series(symbols=['LNS14000000'], start_date='2024-01-01', provider='bls').charting.bls()","handlingStrategy":"validation","validationCode":"df = res.to_df() if hasattr(res, 'to_df') else data\nassert df is not None and len(df) >= 2, 'need >= 2 rows to plot'","typeGuard":"def plottable_row_count(df, minimum: int = 2) -> bool:\n    \"\"\"True when the frame has enough rows for a line/bar chart.\"\"\"\n    return df is not None and len(df) >= minimum","tryCatchPattern":"try:\n    fig = views.bls_chart(**kwargs)\nexcept RuntimeError as e:\n    if str(e) == 'No data found to plot.':\n        # widen the request window and retry once\n        ...","preventionTips":["Assert len(results) >= 2 before charting.","Widen start_date for low-frequency series.","Verify series ids return data for the requested window."],"tags":["charting","bls","insufficient-data","empty-data"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}