{"record":{"id":"24426963fb97a956","repo":"OpenBB-finance/OpenBB","slug":"unable-to-process-supplied-data","errorCode":null,"errorMessage":"Unable to process supplied data.","messagePattern":"Unable to process supplied data\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"openbb_platform/extensions/economy/openbb_economy/economy_views.py","lineNumber":376,"sourceCode":"        if provider != \"bls\":\n            raise RuntimeError(\n                f\"This charting method does not support {provider}. Supported providers: bls.\"\n            )\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","sourceCodeStart":358,"sourceCodeEnd":394,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/extensions/economy/openbb_economy/economy_views.py#L358-L394","documentation":"In the BLS charting view, when the supplied payload is neither a non-empty pandas DataFrame nor successfully convertible via basemodel_to_df, the generic conversion failure is wrapped as RuntimeError('Unable to process supplied data.') with the original exception chained. It means the object passed as data/obbject_item could not be turned into a tabular frame at all.","triggerScenarios":"Passing data= as a dict, a JSON string, a single BaseModel instead of a list, None, or a results object whose fields basemodel_to_df cannot serialize; passing a list of dicts with inconsistent keys.","commonSituations":"Building custom pipelines that hand raw JSON or nested objects into the charting view, version mismatches where basemodel_to_df's accepted input types changed, or passing an OBBject instead of .results.","solutions":["Pass a proper list of pydantic models (e.g. the OBBject .results list) or a pandas DataFrame.","If you have raw records, normalize them first: df = pd.DataFrame(records) and pass data=df.","Check the chained exception (raise __cause__) to see the real conversion error.","Upgrade openbb packages together (openbb-core provides basemodel_to_df) so converter and models match."],"exampleFix":"# before\nfig = views.economy_bls_chart(data={'LNS14000000': [3.5, 3.6]})  # dict not supported\n\n# after\nimport pandas as pd\ndf = pd.DataFrame({'symbol':'LNS14000000','date':pd.date_range('2024-01-01',periods=2),'value':[3.5,3.6]})\nfig = views.economy_bls_chart(data=df)","handlingStrategy":"type-guard","validationCode":"from pandas import DataFrame\npayload = kwargs.get('data') or kwargs.get('obbject_item')\nassert isinstance(payload, (DataFrame, list)), (\n    'data must be a DataFrame or a list of models'\n)","typeGuard":"from pandas import DataFrame\nfrom typing import Any\n\ndef is_chartable_payload(payload: Any) -> bool:\n    \"\"\"True when payload is a non-empty DataFrame or a non-empty list.\"\"\"\n    if isinstance(payload, DataFrame):\n        return not payload.empty\n    return isinstance(payload, list) and len(payload) > 0","tryCatchPattern":"try:\n    fig = views.bls_chart(**kwargs)\nexcept RuntimeError as e:\n    if str(e) == 'Unable to process supplied data.' and e.__cause__:\n        print('conversion failed:', repr(e.__cause__))  # diagnose the real error\n    raise","preventionTips":["Convert raw JSON/dicts to a pandas DataFrame before passing data=.","Pass OBBject.results (a list of models), never the OBBject itself.","Keep openbb-core and provider packages at matching versions."],"tags":["charting","bls","data-conversion","type-mismatch"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}