OpenBB-finance/OpenBB · error · ValueError

Could not find the route `{adjusted_route}` in the charting

Error message

Could not find the route `{adjusted_route}` in the charting functions.

What it means

After stripping the leading slash and replacing '/' with '_', the adjusted route name (e.g. 'equity_price_historical') is not a key in the charting extension's function registry. This means the fetched data's router path has no charting view registered - either the route belongs to an endpoint with no chart function or the needed charting extension/view is not installed.

Source

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

            functions.extend(get_charting_functions_list(view))

        return functions

    def _get_functions(self) -> dict[str, Callable]:
        """Return a dict with the available functions."""
        functions: dict[str, Callable] = {}
        for view in self._extension_views:
            functions.update(get_charting_functions(view))

        return functions

    def _get_chart_function(self, route: str) -> Callable:
        """Given a route, it returns the chart function. The module must contain the given route."""
        if route is None:
            raise ValueError("OBBject was initialized with no function route.")
        adjusted_route = route.replace("/", "_")[1:]
        if adjusted_route not in self._functions:
            raise ValueError(
                f"Could not find the route `{adjusted_route}` in the charting functions."
            )
        return self._functions[adjusted_route]

    def get_params(self) -> Union["ChartParams", None]:
        """Return the ChartQueryParams class for the function the OBBject was created from.

        Without assigning to a variable, it will print the docstring to the console.
        If the class is not defined, the help for the function will be returned.
        """
        # pylint: disable=import-outside-toplevel
        from openbb_charting.query_params import ChartParams

        if self._obbject._route is None:  # pylint: disable=protected-access
            raise ValueError("OBBject was initialized with no function route.")
        charting_function = (
            self._obbject._route  # pylint: disable=protected-access
        ).replace("/", "_")[1:]

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Update openbb charting packages: pip install -U openbb-charting openbb (or the relevant extension)
  2. Check whether a charting view exists for the route: print(list(obj.charting._functions.keys()))
  3. For routes without views, build a chart manually: obj.charting.to_chart(data=obj.to_df())

Example fix

# before
res = obb.news.world(query='nvidia')
res.charting()  # no view registered

# after
res.charting.to_chart(data=res.to_df())
Defensive patterns

Strategy: validation

Validate before calling

adjusted = obj._route.replace('/', '_')[1:]
available = obj.charting._functions
if adjusted not in available:
    raise KeyError(f'no chart view for {adjusted}; available: {sorted(available)[:20]}')

Type guard

def route_has_chart(obj) -> bool:
    adjusted = getattr(obj, '_route', '').replace('/', '_')[1:]
    return adjusted in obj.charting._functions

Try / catch

try:
    res.charting()
except ValueError as e:
    if 'Could not find the route' in str(e):
        res.charting.to_chart(data=res.to_df())

Prevention

When it happens

Trigger: Calling .charting() on an OBBject from an endpoint without a charting view (e.g. some news or macro routes); a custom provider extension whose router lacks a matching charting function; an installed-but-outdated openbb_charting that misses newer routes.

Common situations: New API routes used with an older charting extension; third-party extension endpoints expected to auto-chart; misspelled custom route names in manual OBBject metadata.

Related errors


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