{"record":{"id":"d08f363ac45914a8","repo":"OpenBB-finance/OpenBB","slug":"obbject-was-initialized-with-no-function-route","errorCode":null,"errorMessage":"OBBject was initialized with no function route.","messagePattern":"OBBject was initialized with no function route\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/obbject_extensions/charting/openbb_charting/charting.py","lineNumber":118,"sourceCode":"        \"\"\"Return a list of the available functions.\"\"\"\n        functions: list[str] = []\n        for view in cls._extension_views:\n            functions.extend(get_charting_functions_list(view))\n\n        return functions\n\n    def _get_functions(self) -> dict[str, Callable]:\n        \"\"\"Return a dict with the available functions.\"\"\"\n        functions: dict[str, Callable] = {}\n        for view in self._extension_views:\n            functions.update(get_charting_functions(view))\n\n        return functions\n\n    def _get_chart_function(self, route: str) -> Callable:\n        \"\"\"Given a route, it returns the chart function. The module must contain the given route.\"\"\"\n        if route is None:\n            raise ValueError(\"OBBject was initialized with no function route.\")\n        adjusted_route = route.replace(\"/\", \"_\")[1:]\n        if adjusted_route not in self._functions:\n            raise ValueError(\n                f\"Could not find the route `{adjusted_route}` in the charting functions.\"\n            )\n        return self._functions[adjusted_route]\n\n    def get_params(self) -> Union[\"ChartParams\", None]:\n        \"\"\"Return the ChartQueryParams class for the function the OBBject was created from.\n\n        Without assigning to a variable, it will print the docstring to the console.\n        If the class is not defined, the help for the function will be returned.\n        \"\"\"\n        # pylint: disable=import-outside-toplevel\n        from openbb_charting.query_params import ChartParams\n\n        if self._obbject._route is None:  # pylint: disable=protected-access\n            raise ValueError(\"OBBject was initialized with no function route.\")","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/obbject_extensions/charting/openbb_charting/charting.py#L100-L136","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nobj = OBBject(results=df)\nobj.charting.to_chart()\n\n# after\nobj = OBBject(results=df)\nobj.charting.to_chart(data=df)","handlingStrategy":"type-guard","validationCode":"route = getattr(obj.extra.get('metadata', {}), 'route', None) or getattr(obj, '_route', None)\nassert route, 'OBBject has no route; use to_chart(data=...) instead'","typeGuard":"def has_route(obj) -> bool:\n    return getattr(obj, '_route', None) is not None","tryCatchPattern":"try:\n    obj.charting.get_params()\nexcept ValueError as e:\n    if 'no function route' in str(e):\n        obj.charting.to_chart(data=obj.to_df())","preventionTips":["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"],"tags":["openbb","charting","obbject","route-missing"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}