OpenBB-finance/OpenBB · error · RuntimeError

Failed to automatically create a generic chart with the data

Error message

Failed to automatically create a generic chart with the data provided. -> {e} -> {e.args}

What it means

Charting's automatic charting path first tries the route-specific view, and on failure falls back to create_line_chart on the raw results; if that fallback also throws (nested exception captured in the message), this RuntimeError wraps the root cause. So the message text after '->' is the real failure - usually malformed data for a generic line chart (no index, no numeric columns, wrong types).

Source

Thrown at openbb_platform/obbject_extensions/charting/openbb_charting/charting.py:543

            if render and hasattr(fig, "show"):
                fig.show(**kwargs)

        except (RuntimeError, OpenBBError) as e:
            raise e from e

        except Exception:  # pylint: disable=W0718
            try:
                fig = self.create_line_chart(data=self._obbject.results, render=False, **kwargs)  # type: ignore
                fig = self._set_chart_style(fig)  # type: ignore
                content = fig.show(external=True, **kwargs).to_plotly_json()  # type: ignore
                self._obbject.chart = Chart(
                    fig=fig, content=content, format=self._format
                )
                if render:
                    fig.show(**kwargs)  # type: ignore
            except Exception as e:
                raise RuntimeError(
                    "Failed to automatically create a generic chart with the data provided."
                    + f" -> {e} -> {e.args}"
                ) from e

    # pylint: disable=too-many-locals,inconsistent-return-statements
    def to_chart(
        self,
        data: (
            Union[
                list,
                dict,
                "DataFrame",
                list["DataFrame"],
                "Series",
                list["Series"],
                "ndarray",
                Data,
            ]

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Read the embedded exception after '->' - it is the actual cause; fix that first
  2. Convert results to a DataFrame yourself and pass it explicitly: obj.charting.to_chart(data=obj.to_df())
  3. Verify the OBBject has non-empty, tabular results before calling .charting()

Example fix

# before
res = obb.some.endpoint()
res.charting()

# after
res = obb.some.endpoint()
if res.results:
    res.charting.to_chart(data=res.to_df())
Defensive patterns

Strategy: try-catch

Validate before calling

df = res.to_df() if res.results is not None else None
assert df is not None and not df.empty, 'no tabular results to chart'

Try / catch

try:
    res.charting()
except RuntimeError as e:
    if 'Failed to automatically create' in str(e):
        logging.error('auto-chart failed: %s', e.args)  # root cause embedded after ->'

Prevention

When it happens

Trigger: Calling obbject.charting() where results are non-tabular (e.g. plain dicts, None, or objects basemodel_to_df cannot convert); the endpoint's view raised and the generic line chart also failed on the same data; results with all-nonnumeric columns.

Common situations: Auto-charting endpoints that return metadata objects rather than tables; empty results after a provider outage; custom DataModels without pandas-friendly fields.

Related errors


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