{"record":{"id":"5468b50e41b79a51","repo":"openclaw/openclaw","slug":"unable-to-inspect-the-chrome-mcp-process-tree","errorCode":null,"errorMessage":"Unable to inspect the Chrome MCP process tree.","messagePattern":"Unable to inspect the Chrome MCP process tree\\.","errorType":"exception","errorClass":"ChromeMcpProcessSnapshotError","httpStatus":null,"severity":"warning","filePath":"extensions/browser/src/browser/chrome-mcp-process.ts","lineNumber":117,"sourceCode":"            \"-Command\",\n            'Get-CimInstance Win32_Process | ForEach-Object { \"{0}`t{1}`t{2:o}`t{3}\" -f $_.ProcessId,$_.ParentProcessId,$_.CreationDate,$_.ExecutablePath }',\n          ]\n        : [\"-axww\", \"-o\", \"pid=,ppid=,lstart=,command=\"],\n      {\n        env: windows ? undefined : { ...process.env, LC_ALL: \"C\", TZ: \"UTC\" },\n        logOutput: false,\n        maxBuffer: 4 * 1024 * 1024,\n        timeoutMs: 2_000,\n      },\n    );\n    if (windows) {\n      return parseChromeMcpDelimitedProcessList(stdout, platform);\n    }\n    // lstart is a fixed 24-byte C-locale field. Command shares the same row so\n    // PID reuse within its one-second resolution cannot match another executable.\n    return parseChromeMcpUnixProcessListForTest(stdout, platform);\n  } catch (err) {\n    throw new ChromeMcpProcessSnapshotError(\n      err instanceof Error ? err.message : \"Unable to inspect the Chrome MCP process tree.\",\n      { cause: err },\n    );\n  }\n}\n\nfunction captureChromeMcpProcessTarget(\n  rootPid: number,\n  snapshots: ChromeMcpProcessSnapshot[],\n): ChromeMcpProcessCleanupTarget {\n  const byPid = new Map(snapshots.map((snapshot) => [snapshot.pid, snapshot]));\n  const root = byPid.get(rootPid);\n  if (!root) {\n    throw new ChromeMcpProcessSnapshotError(\n      `Chrome MCP process identity unavailable for pid ${rootPid}.`,\n    );\n  }\n  const childrenByParent = new Map<number, ChromeMcpProcessSnapshot[]>();","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/openclaw/openclaw/blob/01804a75319da4b69c9ab98ceaa30477e22b8c0b/extensions/browser/src/browser/chrome-mcp-process.ts#L99-L135","documentation":"Thrown by listChromeMcpPlatformProcesses when the OS process-listing command (ps on Unix, powershell Get-CimInstance on Windows) fails or times out (2s budget). The generic message appears only when the caught value is not an Error instance; otherwise the original error message is preserved as the ChromeMcpProcessSnapshotError message with the original thrown as cause. This function backs best-effort subprocess-tree cleanup, so a failure here blocks tracking/killing the Chrome MCP process tree.","triggerScenarios":"Calling any Chrome MCP operation that triggers refreshChromeMcpCleanupProcess or terminateChromeMcpProcessTree on a host where `ps` (Unix) or `powershell.exe` (Windows) is absent, not on PATH, permission-denied, or slower than the 2_000ms exec timeout. Also triggered if a custom deps.listProcesses override rejects, or if a non-Error value (e.g. a string or plain object) is thrown by the platform listing.","commonSituations":"Minimal containers (Alpine/distroless) without procps `ps` installed; Windows hosts with PowerShell execution policy restrictions or missing CIM provider; sandboxed environments where invoking `ps`/`powershell` is blocked; slow or overloaded machines where enumerating all processes exceeds 2s; CI runners with restricted process introspection.","solutions":["Ensure the OS process-listing binary is installed and on PATH: install `procps` on Alpine (`apk add procps`) or confirm `ps` exists (`command -v ps`) on Unix; verify `powershell.exe` runs on Windows.","If the host restricts process introspection, inject custom deps via getChromeMcpProcessCleanupDeps() (deps.listProcesses) so the lookup uses an allowed mechanism.","Raise exec throughput or reduce process-table size (close runaway processes) so enumeration completes within the 2_000ms timeout.","Inspect err.cause on the thrown ChromeMcpProcessSnapshotError to see the real underlying spawn/exec error and address that specifically."],"exampleFix":"// before: relies on `ps` being present and fast\n// (default deps path)\nawait refreshChromeMcpCleanupProcess(session);\n\n// after: provide a custom process-listing dep for locked-down hosts\nsetChromeMcpProcessCleanupDeps({\n  listProcesses: async () => readChromeMcpProcessTreeViaProcFs(rootPid),\n});","handlingStrategy":"try-catch","validationCode":"// Confirm the platform process-lister is available before relying on cleanup\nimport { existsSync } from \"node:fs\";\nconst psPresent = process.platform !== \"win32\"\n  ? existsSync(\"/bin/ps\") || existsSync(\"/usr/bin/ps\")\n  : true; // assume powershell on win32\nif (!psPresent) {\n  // install procps or inject deps.listProcesses before launching Chrome MCP\n}","typeGuard":"import { ChromeMcpProcessSnapshotError } from \"./chrome-mcp-contracts.js\";\n\nfunction isProcessSnapshotError(err: unknown): err is ChromeMcpProcessSnapshotError {\n  return err instanceof ChromeMcpProcessSnapshotError;\n}","tryCatchPattern":"try {\n  await refreshChromeMcpCleanupProcess(session);\n} catch (err) {\n  if (err instanceof ChromeMcpProcessSnapshotError) {\n    // best-effort: log err.cause and continue; process tree tracking is unavailable\n    return;\n  }\n  throw err;\n}","preventionTips":["Install procps (`ps`) on minimal containers and confirm powershell runs on Windows hosts before enabling Chrome MCP cleanup.","Inject deps.listProcesses on hosts where the default ps/powershell invocation is blocked.","Never block session close on cleanup-verification failure; treat snapshot errors as soft."],"tags":["chrome-mcp","process-cleanup","exec","platform"],"backgroundTag":null,"analyzedSha":"01804a75319da4b69c9ab98ceaa30477e22b8c0b","analyzedAt":"2026-08-12T04:37:58.197Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}