{"record":{"id":"9e577ed0872b8fd5","repo":"ruvnet/RuView","slug":"netsh-not-found-this-collector-requires-windows","errorCode":null,"errorMessage":"netsh not found. This collector requires Windows.","messagePattern":"netsh not found\\. This collector requires Windows\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"archive/v1/src/sensing/rssi_collector.py","lineNumber":563,"sourceCode":"\n    def _validate_interface(self) -> None:\n        try:\n            result = subprocess.run(\n                [\"netsh\", \"wlan\", \"show\", \"interfaces\"],\n                capture_output=True, text=True, timeout=5.0,\n            )\n            if self._interface not in result.stdout:\n                raise RuntimeError(\n                    f\"WiFi interface '{self._interface}' not found. \"\n                    f\"Check 'netsh wlan show interfaces' for the correct name.\"\n                )\n            if \"disconnected\" in result.stdout.lower().split(self._interface.lower())[1][:200]:\n                raise RuntimeError(\n                    f\"WiFi interface '{self._interface}' is disconnected. \"\n                    f\"Connect to a WiFi network first.\"\n                )\n        except FileNotFoundError:\n            raise RuntimeError(\n                \"netsh not found. This collector requires Windows.\"\n            )\n\n    def _sample_loop(self) -> None:\n        interval = 1.0 / self._rate\n        while self._running:\n            t0 = time.monotonic()\n            try:\n                sample = self._read_sample()\n                self._buffer.append(sample)\n            except Exception:\n                logger.exception(\"Error reading WiFi sample\")\n            elapsed = time.monotonic() - t0\n            sleep_time = max(0.0, interval - elapsed)\n            if sleep_time > 0:\n                time.sleep(sleep_time)\n\n    def _read_sample(self) -> WifiSample:","sourceCodeStart":545,"sourceCodeEnd":581,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/archive/v1/src/sensing/rssi_collector.py#L545-L581","documentation":"subprocess.run(['netsh', ...]) raised FileNotFoundError because no executable named 'netsh' exists on PATH. netsh ships only with Windows, so in practice this means WindowsWifiCollector was instantiated on a non-Windows platform (or on a stripped-down Windows without netsh in PATH). The collector is intentionally Windows-only and reports that clearly.","triggerScenarios":"Constructing WindowsWifiCollector on Linux or macOS; running under a minimal Windows container where netsh is absent; a corrupted PATH that omits C:\\Windows\\System32.","commonSituations":"Cross-platform scripts that unconditionally pick the Windows collector; CI pipelines on Linux runners exercising Windows code paths; Windows Server Core containers without the full netsh toolset.","solutions":["Select the collector by platform: WindowsWifiCollector on win32, MacosWifiCollector on darwin, LinuxWifiCollector on Linux.","On Windows, verify PATH includes System32 ('where netsh') and repair the environment if not.","Run the Linux/macOS build of the RuView pipeline on non-Windows hosts instead.","Gate Windows-only code behind a sys.platform check so imports/instantiation never happen elsewhere."],"exampleFix":"# before\ncollector = WindowsWifiCollector(interface='Wi-Fi', rate=2.0)  # on Linux -> netsh not found\n\n# after\nimport sys\nif sys.platform == 'win32':\n    collector = WindowsWifiCollector(interface='Wi-Fi', rate=2.0)\nelif sys.platform == 'darwin':\n    collector = MacosWifiCollector(rate=2.0)\nelse:\n    collector = LinuxWifiCollector(interface='wlan0', rate=2.0)","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"import sys\nfrom typing import TypeGuard\n\ndef is_windows_collector_supported() -> TypeGuard[None]:\n    \"\"\"True only where netsh exists, i.e. native Windows.\"\"\"\n    return sys.platform == 'win32'\n\nif is_windows_collector_supported():\n    collector = WindowsWifiCollector(interface='Wi-Fi', rate=2.0)","tryCatchPattern":"try:\n    collector.start()\nexcept RuntimeError as exc:\n    if 'requires Windows' in str(exc):\n        raise SystemExit('select the platform-native collector (Linux/macOS)')\n    raise","preventionTips":["Select the RSSI collector via sys.platform (win32/darwin/linux) at one factory point instead of instantiating by hand.","Never import or instantiate WindowsWifiCollector in code paths reachable on non-Windows hosts.","On minimal Windows images, assert 'where netsh' succeeds before enabling the collector."],"tags":["windows","platform","netsh","cross-platform"],"backgroundTag":null,"analyzedSha":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}