ruvnet/RuView · error · RuntimeError

Interface {self._interface} not found in /proc/net/wireless

Error message

Interface {self._interface} not found in /proc/net/wireless

What it means

_read_proc_wireless() finished iterating every line of /proc/net/wireless without finding one containing the configured interface name, so it raises RuntimeError. Unlike the is_available() failure (raised at start time), this happens at sample time: the interface was acceptable earlier (or validation was skipped) and has since disappeared from the procfs table, or the name never matched any row.

Source

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

        """Parse /proc/net/wireless for the configured interface."""
        try:
            with open("/proc/net/wireless", "r") as f:
                for line in f:
                    if self._interface in line:
                        # Format: iface: status quality signal noise ...
                        parts = line.split()
                        # parts[0] = "wlan0:", parts[2]=quality, parts[3]=signal, parts[4]=noise
                        quality_raw = float(parts[2].rstrip("."))
                        signal_raw = float(parts[3].rstrip("."))
                        noise_raw = float(parts[4].rstrip("."))
                        # Normalise quality to 0..1 (max is typically 70)
                        quality = min(1.0, max(0.0, quality_raw / 70.0))
                        return signal_raw, noise_raw, quality
        except (FileNotFoundError, IndexError, ValueError) as exc:
            raise RuntimeError(
                f"Failed to read /proc/net/wireless for {self._interface}: {exc}"
            ) from exc
        raise RuntimeError(
            f"Interface {self._interface} not found in /proc/net/wireless"
        )

    def _read_iw_station(self) -> tuple[int, int, int]:
        """Run ``iw dev <iface> station dump`` and parse TX/RX/retries."""
        try:
            result = subprocess.run(
                ["iw", "dev", self._interface, "station", "dump"],
                capture_output=True,
                text=True,
                timeout=2.0,
            )
            text = result.stdout

            tx_bytes = self._extract_int(text, r"tx bytes:\s*(\d+)")
            rx_bytes = self._extract_int(text, r"rx bytes:\s*(\d+)")
            retries = self._extract_int(text, r"tx retries:\s*(\d+)")
            return tx_bytes, rx_bytes, retries

View on GitHub (pinned to 4685618388)

Solutions

  1. Inspect the current table with 'cat /proc/net/wireless' and confirm the interface row exists.
  2. Bring the interface back up and associate with an AP, then recreate and start the collector.
  3. Stop the collector on repeated sample failures and re-run is_available() before restarting.
  4. Pin the interface name explicitly instead of relying on auto-detection across re-enumeration.

Example fix

# before
sample = collector.collect_once()  # RuntimeError: Interface wlan0 not found in /proc/net/wireless

# after
ok, reason = LinuxWifiCollector.is_available(interface)
if not ok:
    collector.stop()
    raise RuntimeError(f're-validate failed: {reason}')
sample = collector.collect_once()
Defensive patterns

Strategy: validation

Validate before calling

ok, reason = LinuxWifiCollector.is_available(interface)
if not ok:
    raise RuntimeError(f'cannot sample, interface unavailable: {reason}')
sample = collector.collect_once()

Prevention

When it happens

Trigger: The WiFi interface went down, was rfkill-blocked, or was re-enumerated between start() and collect_once(); the driver unregistered the wiphy; a name that does not literally appear in any row (typo or alternate naming) slipped past validation because it substring-matched during is_available but the table changed.

Common situations: Suspend/resume or WiFi restarts during long-running collection; USB adapters dropping off the bus; network-manager recreating the interface; running after 'ip link set wlan0 down'.

Related errors


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