{"record":{"id":"d9d91bcd6499dce6","repo":"nicolargo/glances","slug":"unknown-pid-process-pid","errorCode":null,"errorMessage":"Unknown PID process {pid}","messagePattern":"Unknown PID process (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"glances/outputs/glances_restful_api.py","lineNumber":1429,"sourceCode":"        try:\n            args_json = self._sanitize_args()[item]\n        except Exception as e:\n            raise HTTPException(status.HTTP_404_NOT_FOUND, f\"Cannot get args item ({str(e)})\")\n\n        return GlancesJSONResponse(args_json)\n\n    def _api_set_extended_processes(self, pid: str):\n        \"\"\"Glances API RESTful implementation.\n\n        Set the extended process stats for the given PID\n        HTTP/200 if OK\n        HTTP/400 if PID is not found\n        HTTP/404 if others error\n        \"\"\"\n        process_stats = glances_processes.get_stats(int(pid))\n\n        if not process_stats:\n            raise HTTPException(status.HTTP_404_NOT_FOUND, f\"Unknown PID process {pid}\")\n\n        glances_processes.extended_process = process_stats\n\n        return GlancesJSONResponse(True)\n\n    def _api_disable_extended_processes(self):\n        \"\"\"Glances API RESTful implementation.\n\n        Disable extended process stats\n        HTTP/200 if OK\n        HTTP/400 if PID is not found\n        HTTP/404 if others error\n        \"\"\"\n        glances_processes.extended_process = None\n\n        return GlancesJSONResponse(True)\n\n    def _api_get_extended_processes(self):","sourceCodeStart":1411,"sourceCodeEnd":1447,"githubUrl":"https://github.com/nicolargo/glances/blob/a240d8dfb3105a38b5964357ec21768594b0e83e/glances/outputs/glances_restful_api.py#L1411-L1447","documentation":"HTTP 404 raised by PUT /api/4/processes/{pid}/extended (set extended process) when glances_processes.get_stats(int(pid)) returns a falsy value, meaning no stats are currently cached for that PID. The process may have exited between listing and selection, or it is not visible to Glances' process collector.","triggerScenarios":"PUT /api/4/processes/1234/extended where PID 1234 is dead, not yet in the process cache (stats update every refresh interval), hidden by process filtering, or inside another PID namespace (container).","commonSituations":"Web UI race: user clicks a process that exits before the request; monitoring containerized workloads from the host (or vice versa); strict process filtering excluding the PID.","solutions":["Retry shortly — the process cache refreshes on the stats update cycle, newly spawned PIDs appear then","Verify with GET /api/4/processes that the PID is in the current list before extending it","Check --enable-process-extended is supported and no process filter (name/user regex) excludes the target","If monitoring containers, query the PID from the same PID namespace as glances"],"exampleFix":"# before\nPUT /api/4/processes/4242/extended\n# after (confirm existence first)\nGET /api/4/processes | jq '.[] | select(.pid==4242)'\nPUT /api/4/processes/4242/extended","handlingStrategy":"validation","validationCode":"live = {p['pid'] for p in requests.get(f'{base}/api/4/processes').json()}\nif pid not in live:\n    raise LookupError(f'PID {pid} not visible to glances')","typeGuard":"def pid_exists(pid: int) -> bool:\n    return any(p['pid'] == pid for p in requests.get(f'{base}/api/4/processes').json())","tryCatchPattern":"try:\n    r = requests.put(f'{base}/api/4/processes/{pid}/extended')\n    r.raise_for_status()\nexcept requests.HTTPError as e:\n    if e.response.status_code == 404:\n        # process gone: stop tracking\n        tracked.discard(pid)\n    else:\n        raise","preventionTips":["Check the process list snapshot before acting on a PID","Treat 404 as terminal for a PID, not retryable","Run glances in the same PID namespace as target processes"],"tags":["glances","rest-api","process","pid","http-404"],"backgroundTag":"http-404-not-found","analyzedSha":"a240d8dfb3105a38b5964357ec21768594b0e83e","analyzedAt":"2026-08-27T19:15:19.178Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}