ruvnet/RuView · error · RuntimeError

netsh not found. This collector requires Windows.

Error message

netsh not found. This collector requires Windows.

What it means

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.

Source

Thrown at archive/v1/src/sensing/rssi_collector.py:563

    def _validate_interface(self) -> None:
        try:
            result = subprocess.run(
                ["netsh", "wlan", "show", "interfaces"],
                capture_output=True, text=True, timeout=5.0,
            )
            if self._interface not in result.stdout:
                raise RuntimeError(
                    f"WiFi interface '{self._interface}' not found. "
                    f"Check 'netsh wlan show interfaces' for the correct name."
                )
            if "disconnected" in result.stdout.lower().split(self._interface.lower())[1][:200]:
                raise RuntimeError(
                    f"WiFi interface '{self._interface}' is disconnected. "
                    f"Connect to a WiFi network first."
                )
        except FileNotFoundError:
            raise RuntimeError(
                "netsh not found. This collector requires Windows."
            )

    def _sample_loop(self) -> None:
        interval = 1.0 / self._rate
        while self._running:
            t0 = time.monotonic()
            try:
                sample = self._read_sample()
                self._buffer.append(sample)
            except Exception:
                logger.exception("Error reading WiFi sample")
            elapsed = time.monotonic() - t0
            sleep_time = max(0.0, interval - elapsed)
            if sleep_time > 0:
                time.sleep(sleep_time)

    def _read_sample(self) -> WifiSample:

View on GitHub (pinned to 4685618388)

Solutions

  1. Select the collector by platform: WindowsWifiCollector on win32, MacosWifiCollector on darwin, LinuxWifiCollector on Linux.
  2. On Windows, verify PATH includes System32 ('where netsh') and repair the environment if not.
  3. Run the Linux/macOS build of the RuView pipeline on non-Windows hosts instead.
  4. Gate Windows-only code behind a sys.platform check so imports/instantiation never happen elsewhere.

Example fix

# before
collector = WindowsWifiCollector(interface='Wi-Fi', rate=2.0)  # on Linux -> netsh not found

# after
import sys
if sys.platform == 'win32':
    collector = WindowsWifiCollector(interface='Wi-Fi', rate=2.0)
elif sys.platform == 'darwin':
    collector = MacosWifiCollector(rate=2.0)
else:
    collector = LinuxWifiCollector(interface='wlan0', rate=2.0)
Defensive patterns

Strategy: type-guard

Type guard

import sys
from typing import TypeGuard

def is_windows_collector_supported() -> TypeGuard[None]:
    """True only where netsh exists, i.e. native Windows."""
    return sys.platform == 'win32'

if is_windows_collector_supported():
    collector = WindowsWifiCollector(interface='Wi-Fi', rate=2.0)

Try / catch

try:
    collector.start()
except RuntimeError as exc:
    if 'requires Windows' in str(exc):
        raise SystemExit('select the platform-native collector (Linux/macOS)')
    raise

Prevention

When it happens

Trigger: Constructing WindowsWifiCollector on Linux or macOS; running under a minimal Windows container where netsh is absent; a corrupted PATH that omits C:\Windows\System32.

Common situations: 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.

Related errors


AI-assisted analysis of ruvnet/RuView@4685618388 (2026-08-16). Data as JSON: /api/errors/9e577ed0872b8fd5. Report an issue: GitHub.