{"record":{"id":"ab658063961a43c9","repo":"nicolargo/glances","slug":"cannot-get-item-description-for-plugin-plugin","errorCode":null,"errorMessage":"Cannot get {item} description for plugin {plugin} ({str(e)})","messagePattern":"Cannot get (.+?) description for plugin (.+?) \\((.+?)\\)","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"warning","filePath":"glances/outputs/glances_restful_api.py","lineNumber":1238,"sourceCode":"            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(\n                status.HTTP_404_NOT_FOUND, f\"Cannot get {item} description for plugin {plugin} ({str(e)})\"\n            )\n        else:\n            return GlancesJSONResponse(ret)\n\n    def _api_item_unit(self, plugin: str, item: str):\n        \"\"\"Glances API RESTful implementation.\n\n        Return the JSON representation of the couple plugin/item unit\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 unit\n            ret = self.stats.get_plugin(plugin).get_item_info(item, 'unit')","sourceCodeStart":1220,"sourceCodeEnd":1256,"githubUrl":"https://github.com/nicolargo/glances/blob/a240d8dfb3105a38b5964357ec21768594b0e83e/glances/outputs/glances_restful_api.py#L1220-L1256","documentation":"Raised when get_item_info(item, 'description') fails on the item-description endpoint, returned as HTTP 404. Item metadata comes from the plugin's items description dict; failure means the item is unknown to that metadata (or the plugin raised).","triggerScenarios":"GET /api/4/<plugin>/<item>/description with an item absent from the plugin's items descriptions — commonly a valid stat key that has no registered description, or a typo.","commonSituations":"New stat fields added in a glances release before their descriptions, or clients enumerating stats keys and blindly requesting descriptions for all of them.","solutions":["GET /api/4/<plugin>/views or /api/4/<plugin> to see known items","Treat 404 on description as 'no description available' and fall back to a default label","Upgrade glances so item descriptions match stats fields"],"exampleFix":"# before\nlabel = fetch(f'/api/4/cpu/{item}/description')  # raises 404\n# after\nresp = fetch(f'/api/4/cpu/{item}/description')\nlabel = resp.json() if resp.ok else item  # graceful fallback","handlingStrategy":"fallback","validationCode":"views = httpx.get(f'{BASE}/api/4/{plugin}/views').json()\nhas_desc = item in views","typeGuard":"def has_description(item: str, views: dict) -> bool:\n    return item in views","tryCatchPattern":"r = httpx.get(f'{BASE}/api/4/{plugin}/{item}/description')\ndesc = r.json() if r.status_code == 200 else item  # fall back to raw name","preventionTips":["Default to the item name when no description exists","Do not assume every stat item has metadata"],"tags":["glances","rest-api","http-404","description","metadata"],"backgroundTag":"http-404-resource-not-found","analyzedSha":"a240d8dfb3105a38b5964357ec21768594b0e83e","analyzedAt":"2026-08-27T19:15:19.178Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}