{"record":{"id":"4eaf5e71cf5b9463","repo":"nicolargo/glances","slug":"cannot-get-item-item-in-plugin-view-plugin-s","errorCode":null,"errorMessage":"Cannot get item {item} in plugin view {plugin} ({str(e)})","messagePattern":"Cannot get item (.+?) in plugin view (.+?) \\((.+?)\\)","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"warning","filePath":"glances/outputs/glances_restful_api.py","lineNumber":1171,"sourceCode":"\n    def _api_item_views(self, plugin: str, item: str):\n        \"\"\"Glances API RESTful implementation.\n\n        Return the JSON view representation of the couple plugin/item\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 views\n            ret = self.stats.get_plugin(plugin).get_views().get(item)\n        except Exception as e:\n            raise HTTPException(\n                status.HTTP_404_NOT_FOUND,\n                f\"Cannot get item {item} in plugin view {plugin} ({str(e)})\",\n            )\n\n        return GlancesJSONResponse(ret)\n\n    def _api_key_views(self, plugin: str, item: str, key: str):\n        \"\"\"Glances API RESTful implementation.\n\n        Return the JSON view representation of plugin/item/key\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))","sourceCodeStart":1153,"sourceCodeEnd":1189,"githubUrl":"https://github.com/nicolargo/glances/blob/a240d8dfb3105a38b5964357ec21768594b0e83e/glances/outputs/glances_restful_api.py#L1153-L1189","documentation":"Raised when get_views().get(item) fails on the item-views endpoint, returned as HTTP 404. Views map display attributes per item; failure usually means the item has no view entry (get returns None or the plugin raised). The embedded exception clarifies.","triggerScenarios":"GET /api/4/<plugin>/<item>/views where item is not a key of the plugin's views dict — e.g., an item that exists in stats but has no view definition, or a typo.","commonSituations":"Querying view metadata for items that are internal/undisplayed, or name mismatches across glances versions.","solutions":["GET /api/4/<plugin>/views and use exact item keys from the response","Verify the item exists in stats via /api/4/<plugin>/<item>","Align client field names with the deployed glances version"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"views = httpx.get(f'{BASE}/api/4/{plugin}/views').json()\nif item not in views:\n    print(f'{item} has no view entry')","typeGuard":"def has_view(item: str, views: dict) -> bool:\n    return isinstance(views, dict) and item in views","tryCatchPattern":"try:\n    v = httpx.get(f'{BASE}/api/4/{plugin}/{item}/views').json()\nexcept httpx.HTTPStatusError as e:\n    if e.response.status_code == 404:\n        v = None\n    else:\n        raise","preventionTips":["Fetch the full views dict once and check membership locally"],"tags":["glances","rest-api","http-404","views","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"}