{"record":{"id":"91f163b9d18f8d4a","repo":"nicolargo/glances","slug":"cannot-get-history-for-plugin-plugin-str-e","errorCode":null,"errorMessage":"Cannot get history for plugin {plugin} ({str(e)})","messagePattern":"Cannot get history for plugin (.+?) \\((.+?)\\)","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"glances/outputs/glances_restful_api.py","lineNumber":1220,"sourceCode":"    def _api_item_history(self, plugin: str, item: str, nb: int = 0):\n        \"\"\"Glances API RESTful implementation.\n\n        Return the JSON representation of the couple plugin/history of item\n        HTTP/200 if OK\n        HTTP/400 if plugin is not found\n        HTTP/404 if others error\n\n        \"\"\"\n        self._check_if_plugin_available(plugin)\n\n        # Update the stat\n        self.__update_stats(get_plugin_dependencies(plugin))\n\n        try:\n            # Get the RAW value of the stat history\n            ret = self.stats.get_plugin(plugin).get_raw_history(item, nb=nb)\n        except Exception as e:\n            raise HTTPException(status.HTTP_404_NOT_FOUND, f\"Cannot get history for plugin {plugin} ({str(e)})\")\n        else:\n            return GlancesJSONResponse(ret)\n\n    def _api_item_description(self, plugin: str, item: str):\n        \"\"\"Glances API RESTful implementation.\n\n        Return the JSON representation of the couple plugin/item description\n        HTTP/200 if OK\n        HTTP/400 if plugin is not found\n        HTTP/404 if others error\n        \"\"\"\n        self._check_if_plugin_available(plugin)\n\n        try:\n            # Get the description\n            ret = self.stats.get_plugin(plugin).get_item_info(item, 'description')\n        except Exception as e:\n            raise HTTPException(","sourceCodeStart":1202,"sourceCodeEnd":1238,"githubUrl":"https://github.com/nicolargo/glances/blob/a240d8dfb3105a38b5964357ec21768594b0e83e/glances/outputs/glances_restful_api.py#L1202-L1238","documentation":"Raised when get_raw_history(item, nb) fails for a specific item's history, returned as HTTP 404. Item-level history requires both the plugin's history buffer and the item's presence in the stats structure; failure means one of these is missing or the underlying history export raised.","triggerScenarios":"GET /api/4/<plugin>/history/<nb>/<item> with an item that is not a history-tracked field, or before any samples exist in the history buffer.","commonSituations":"Querying right after server start, history disabled via --disable-history, or item names that changed across glances versions.","solutions":["Wait for several refresh cycles so the history buffer fills","Confirm history is enabled on the server","GET /api/4/<plugin>/history (full history) to see which items are tracked","Match item names to the current version's stats output"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"full = httpx.get(f'{BASE}/api/4/{plugin}/history/{nb}').json()\nif item not in full:\n    print(f'no history tracked for {item}')","typeGuard":"def has_history(item: str, history: dict) -> bool:\n    return isinstance(history, dict) and item in history","tryCatchPattern":"try:\n    h = httpx.get(f'{BASE}/api/4/{plugin}/history/{nb}/{item}').json()\nexcept httpx.HTTPStatusError as e:\n    if e.response.status_code == 404:\n        h = []  # no history yet for this item\n    else:\n        raise","preventionTips":["Allow a warm-up period before querying history","Check full plugin history to see which items are tracked"],"tags":["glances","rest-api","http-404","history","item"],"backgroundTag":"http-404-resource-not-found","analyzedSha":"a240d8dfb3105a38b5964357ec21768594b0e83e","analyzedAt":"2026-08-27T19:15:19.178Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}