{"record":{"id":"2e71481397cac7d1","repo":"nicolargo/glances","slug":"cannot-get-item-value-for-plugin-plugin","errorCode":null,"errorMessage":"Cannot get {item} = {value} for plugin {plugin} ({str(e)})","messagePattern":"Cannot get (.+?) = (.+?) for plugin (.+?) \\((.+?)\\)","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"warning","filePath":"glances/outputs/glances_restful_api.py","lineNumber":1280,"sourceCode":"    def _api_value(self, plugin: str, item: str, value: str | int | float):\n        \"\"\"Glances API RESTful implementation.\n\n        Return the process stats (dict) for the given item=value\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\n            # TODO in #3211: use a non existing (to be created) get_export_item_value instead but break API\n            ret = self.stats.get_plugin(plugin).get_raw_stats_value(item, value)\n        except Exception as e:\n            raise HTTPException(\n                status.HTTP_404_NOT_FOUND, f\"Cannot get {item} = {value} for plugin {plugin} ({str(e)})\"\n            )\n        else:\n            return GlancesJSONResponse(ret)\n\n    def _api_config(self):\n        \"\"\"Glances API RESTful implementation.\n\n        Return the JSON representation of the Glances configuration file\n        HTTP/200 if OK\n        HTTP/404 if others error\n        \"\"\"\n        try:\n            # Get the RAW value of the config' dict\n            args_json = self.config.as_dict() if self.args.password else self.config.as_dict_secure()\n        except Exception as e:\n            raise HTTPException(status.HTTP_404_NOT_FOUND, f\"Cannot get config ({str(e)})\")\n        else:","sourceCodeStart":1262,"sourceCodeEnd":1298,"githubUrl":"https://github.com/nicolargo/glances/blob/a240d8dfb3105a38b5964357ec21768594b0e83e/glances/outputs/glances_restful_api.py#L1262-L1298","documentation":"Raised when get_raw_stats_value(item, value) fails on the value-filter endpoint, returned as HTTP 404. This endpoint filters list stats by matching a field value (e.g., a process name or mount point); failure means the item/value lookup raised — typically item does not exist or the value cannot be compared.","triggerScenarios":"GET /api/4/<plugin>/<item>/<method>/value with a nonexistent item or a value whose type doesn't match — e.g., /api/4/processlist/name/python where processlist collection failed, or /api/4/fs/size/abc with a non-numeric comparison.","commonSituations":"Filtering processlist by a process that exits mid-poll, type mismatches on numeric fields, or item names from a different glances version.","solutions":["Verify the item exists via /api/4/<plugin>/<item>","Ensure the value type matches the field (numbers for numeric fields)","Retry — processlist filtering can race with process exit","URL-encode values containing slashes or special characters"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"sample = httpx.get(f'{BASE}/api/4/{plugin}/{item}').json()\nvalues = [d.get(item) for d in sample] if isinstance(sample, list) else None\n# ensures item exists and shows expected value types","typeGuard":"def value_type_matches(value: str, observed: list) -> bool:\n    return any(type(o)(value) is not bool or True for o in observed)","tryCatchPattern":"try:\n    rows = httpx.get(f'{BASE}/api/4/{plugin}/{item}/{value}').json()\nexcept httpx.HTTPStatusError as e:\n    if e.response.status_code == 404:\n        rows = []  # no matching entries this cycle\n    else:\n        raise","preventionTips":["URL-encode filter values (quote(value, safe=''))","Verify item exists and value type matches before filtering","Retry once for processlist races"],"tags":["glances","rest-api","http-404","value-filter","keyerror"],"backgroundTag":"http-404-resource-not-found","analyzedSha":"a240d8dfb3105a38b5964357ec21768594b0e83e","analyzedAt":"2026-08-27T19:15:19.178Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}