{"record":{"id":"0d22c64825cb4fc8","repo":"nodejs/node","slug":"unimplemented-platform-platform-system","errorCode":null,"errorMessage":"Unimplemented platform: {platform.system()}","messagePattern":"Unimplemented platform: (.+?)","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"deps/v8/tools/dev/setup-reclient.py","lineNumber":49,"sourceCode":"    MachineType.GOOGLE_LAPTOP: \"Google Laptop\",\n}\n\n\ndef DetectShell():\n  # We could just read the SHELL environment variable, but that can be\n  # inaccurate when users use multiple shells. So instead, detect the\n  # shell that this script was called from.\n  pid = subprocess.check_output(f\"ps -p {os.getpid()} -o ppid=\", shell=True)\n  pid = pid.decode(\"utf-8\").strip()\n  if platform.system() == \"Linux\":\n    shell = subprocess.check_output([\"readlink\", \"-f\", f\"/proc/{pid}/exe\"])\n    return shell.decode(\"utf-8\").strip()\n  elif platform.system() == \"Darwin\":\n    shell = subprocess.check_output(\n        f\"lsof -p {pid} | grep txt | head -1\", shell=True)\n    return shell.decode(\"utf-8\").strip().split(\" \")[-1]\n  else:\n    raise Exception(f\"Unimplemented platform: {platform.system()}\")\n\n\nSHELL = DetectShell()\n\n\ndef InstallGCloudPublic():\n  existing = subprocess.call(\"which gcloud\", shell=True)\n  if existing == 0:\n    print(\"GCloud is already installed, great.\")\n    return False\n  print(\"Downloading and running GCloud installer. \"\n        \"Please let it add the CLI tools to your PATH when prompted.\")\n  subprocess.check_call(\n      \"curl -o gcloud-install.sh https://sdk.cloud.google.com\", shell=True)\n  subprocess.check_call(\"bash gcloud-install.sh\", shell=True)\n  subprocess.check_call(\"rm gcloud-install.sh\", shell=True)\n  return True\n","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/v8/tools/dev/setup-reclient.py#L31-L67","documentation":"setup-reclient.py's DetectShell() identifies the parent shell to wire up reclient (the remote execution client wrapper). It only knows how to resolve the shell on Linux (via /proc/<pid>/exe readlink) and macOS (via lsof). On any other platform.system() return value (e.g. 'Windows', 'AIX', 'FreeBSD') it raises a bare Exception with no recovery path, halting the reclient bootstrap.","triggerScenarios":"Running `v8/tools/dev/setup-reclient.py` (or any script that imports and calls DetectShell()) on Windows or another non-Linux/non-Darwin OS. The function calls subprocess.check_output for platform-specific shell detection and falls into the unconditional `else: raise` branch.","commonSituations":"A developer on Windows attempts to set up reclient for V8 builds; running under WSL is fine (Linux) but native Windows fails. Also triggered in CI images that report an unexpected platform string, or when platform.system() is mocked/stubbed during testing.","solutions":["Run the script under WSL2 or a Linux container if you are on Windows; DetectShell only supports Linux and Darwin.","If you must run natively on an unsupported OS, extend DetectShell() with a branch for platform.system() == 'Windows' (e.g. resolve the shell via the %COMSPEC% env var) before the else clause.","Verify platform.system() returns what you expect (`python3 -c \"import platform; print(platform.system())\"`) to rule out an odd environment."],"exampleFix":"// before\n  else:\n    raise Exception(f\"Unimplemented platform: {platform.system()}\")\n// after\n  elif platform.system() == \"Windows\":\n    return os.environ.get(\"COMSPEC\", \"cmd.exe\")\n  else:\n    raise Exception(f\"Unimplemented platform: {platform.system()}\")","handlingStrategy":"validation","validationCode":"import platform, sys\n_supported = {'Linux', 'Darwin'}\nif platform.system() not in _supported:\n    sys.exit(f\"setup-reclient needs Linux or Darwin; this host reports {platform.system()!r}. Use WSL or extend DetectShell().\")","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Standardize reclient bootstrap on a Linux/Darwin environment (WSL2 on Windows).","Pin the V8 tooling revision so DetectShell behavior doesn't change unexpectedly.","Add a CI matrix step asserting platform.system() is in the supported set before invoking setup-reclient."],"tags":["platform","shell-detection","reclient","v8-build","windows"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}