OpenBB-finance/OpenBB · error · ValueError
OBBject was initialized with no function route.
Error message
OBBject was initialized with no function route.
What it means
Raised by Charting._get_chart_function when the OBBject being charted has route None, i.e. it was constructed directly (OBBject(results=...)) rather than returned by a router command. Charting resolves the plotting function from the provider route stored on the OBBject; without a route there is nothing to look up.
Source
Thrown at openbb_platform/obbject_extensions/charting/openbb_charting/charting.py:118
"""Return a list of the available functions."""
functions: list[str] = []
for view in cls._extension_views:
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.")View on GitHub (pinned to 3e071fcc2c)
Solutions
- Chart data through a real API call so the OBBject carries its route: res = obb.equity.price.historical(...); res.charting()
- If wrapping custom data, set the route metadata explicitly or use Charting.to_chart(data=...) instead of route-based lookup
- Avoid reconstructing OBBject from dicts without preserving extra['metadata'].route
Example fix
# before obj = OBBject(results=df) obj.charting.to_chart() # after obj = OBBject(results=df) obj.charting.to_chart(data=df)
Defensive patterns
Strategy: type-guard
Validate before calling
route = getattr(obj.extra.get('metadata', {}), 'route', None) or getattr(obj, '_route', None)
assert route, 'OBBject has no route; use to_chart(data=...) instead' Type guard
def has_route(obj) -> bool:
return getattr(obj, '_route', None) is not None Try / catch
try:
obj.charting.get_params()
except ValueError as e:
if 'no function route' in str(e):
obj.charting.to_chart(data=obj.to_df()) Prevention
- Chart OBBjects returned by obb.* commands, not hand-built ones
- Preserve extra['metadata'].route when persisting/reloading OBBjects
- Use to_chart(data=...) for custom data
When it happens
Trigger: Manually instantiating OBBject and calling .charting.to_chart() or .get_params(); serializing/de-serializing an OBBject and losing the route metadata; calling charting internals with a route argument of None.
Common situations: Building custom OBBjects to wrap user data; deepcopy or persistence round-trips that drop the private _route attribute; calling internal _get_chart_function directly in tests.
Related errors
- Error: No data to plot.
- Expiration field not found in the data.
- Price field not found in the data.
- Error: Rate column not found in the data.
- Error: Date column not found in the data.
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/d08f363ac45914a8.
Report an issue: GitHub.