{"record":{"id":"4d843ec271a7cb73","repo":"nicolargo/glances","slug":"cannot-get-plugin-plugin-str-e","errorCode":null,"errorMessage":"Cannot get plugin {plugin} ({str(e)})","messagePattern":"Cannot get plugin (.+?) \\((.+?)\\)","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"glances/outputs/glances_restful_api.py","lineNumber":1005,"sourceCode":"\n    def _api(self, plugin: str):\n        \"\"\"Glances API RESTful implementation.\n\n        Return the JSON representation 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        # 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_api()\n        except Exception as e:\n            raise HTTPException(status.HTTP_404_NOT_FOUND, f\"Cannot get plugin {plugin} ({str(e)})\")\n\n        return GlancesJSONResponse(statval)\n\n    def _check_if_plugin_available(self, plugin: str) -> None:\n        if plugin in self.plugins_list:\n            return\n\n        raise HTTPException(\n            status.HTTP_400_BAD_REQUEST, f\"Unknown plugin {plugin} (available plugins: {self.plugins_list})\"\n        )\n\n    def _api_top(self, plugin: str, nb: int = 0):\n        \"\"\"Glances API RESTful implementation.\n\n        Return the JSON representation of a given plugin limited to the top nb items.\n        It is used to reduce the payload of the HTTP response (example: processlist).\n\n        HTTP/200 if OK","sourceCodeStart":987,"sourceCodeEnd":1023,"githubUrl":"https://github.com/nicolargo/glances/blob/a240d8dfb3105a38b5964357ec21768594b0e83e/glances/outputs/glances_restful_api.py#L987-L1023","documentation":"Raised when a known plugin's get_api() call fails, returned as HTTP 404 with the plugin name and underlying exception. The plugin passed availability checks, so this is an internal data-fetch failure, not an unknown-plugin error (which would be HTTP 400).","triggerScenarios":"GET /api/4/<plugin> where the plugin is in plugins_list but get_api() raises during stats refresh or serialization — e.g., sensors/gpu plugin failing to read a device file mid-poll.","commonSituations":"Transient hardware sensor read failures, Snap confinement blocking /sys access, or a plugin whose optional dependency is missing at data-collection time.","solutions":["Read the embedded exception in the 404 body and the server log to identify the cause","Retry the request — transient collection errors often clear on the next refresh cycle","Install missing optional dependencies for the plugin (e.g., batinfo, pynvml)","If persistent, disable the plugin with --disable-plugin and report the traceback upstream"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"plugins = httpx.get(f'{BASE}/api/4/plugins').json()\nassert plugin in plugins, f'{plugin} not available (have: {plugins})'","typeGuard":null,"tryCatchPattern":"for attempt in range(3):\n    r = httpx.get(f'{BASE}/api/4/{plugin}', timeout=10)\n    if r.status_code == 200:\n        break\n    time.sleep(refresh_interval)\nelse:\n    log.error(f'plugin {plugin} failed: {r.text}')","preventionTips":["Validate plugin name against /api/4/plugins first","Retry once after a refresh cycle before reporting failure"],"tags":["glances","rest-api","http-404","plugin"],"backgroundTag":"http-404-resource-not-found","analyzedSha":"a240d8dfb3105a38b5964357ec21768594b0e83e","analyzedAt":"2026-08-27T19:15:19.178Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}