{"record":{"id":"9b2d3d7c781afae9","repo":"nicolargo/glances","slug":"cannot-get-plugin-history-plugin-str-e","errorCode":null,"errorMessage":"Cannot get plugin history {plugin} ({str(e)})","messagePattern":"Cannot get plugin history (.+?) \\((.+?)\\)","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"glances/outputs/glances_restful_api.py","lineNumber":1061,"sourceCode":"    def _api_history(self, plugin: str, nb: int = 0):\n        \"\"\"Glances API RESTful implementation.\n\n        Return the JSON representation of a given plugin history\n        Limit to the last nb items (all if nb=0)\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        # Update the stat\n        self.__update_stats(get_plugin_dependencies(plugin))\n\n        try:\n            # Get the RAW value of the stat ID\n            statval = self.stats.get_plugin(plugin).get_raw_history(nb=int(nb))\n        except Exception as e:\n            raise HTTPException(status.HTTP_404_NOT_FOUND, f\"Cannot get plugin history {plugin} ({str(e)})\")\n\n        return statval\n\n    def _api_limits(self, plugin: str):\n        \"\"\"Glances API RESTful implementation.\n\n        Return the JSON limits of a given plugin\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 RAW value of the stat limits\n            ret = self.stats.get_plugin(plugin).get_limits()\n        except Exception as e:\n            raise HTTPException(status.HTTP_404_NOT_FOUND, f\"Cannot get limits for plugin {plugin} ({str(e)})\")","sourceCodeStart":1043,"sourceCodeEnd":1079,"githubUrl":"https://github.com/nicolargo/glances/blob/a240d8dfb3105a38b5964357ec21768594b0e83e/glances/outputs/glances_restful_api.py#L1043-L1079","documentation":"Raised when get_raw_history(nb) fails on the history endpoint, returned as HTTP 404. History requires the plugin's stats history buffer; failure usually means history is not available for that plugin or the export history feature is disabled/unpopulated.","triggerScenarios":"GET /api/4/<plugin>/history/<nb> when get_raw_history() raises — e.g., requesting history for a plugin without history support, or before any samples have been collected.","commonSituations":"Querying history immediately after server start (empty buffer), or running with --disable-history which removes the history backend.","solutions":["Wait a few refresh cycles so the history buffer accumulates samples before querying","Ensure history is not disabled on the server (--disable-history absent)","Request a smaller nb within the configured history size","Verify the plugin supports history (most stats plugins do; some like help do not)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if time_since_server_start < 3 * refresh_interval:\n    print('history buffer not yet populated; wait before querying')","typeGuard":null,"tryCatchPattern":"try:\n    hist = httpx.get(f'{BASE}/api/4/{plugin}/history/{nb}').json()\nexcept httpx.HTTPStatusError as e:\n    if e.response.status_code == 404:\n        hist = []  # no history yet\n    else:\n        raise","preventionTips":["Warm up before querying history (several refresh cycles)","Do not run the server with --disable-history if you need history endpoints"],"tags":["glances","rest-api","http-404","history"],"backgroundTag":"http-404-resource-not-found","analyzedSha":"a240d8dfb3105a38b5964357ec21768594b0e83e","analyzedAt":"2026-08-27T19:15:19.178Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}