ruvnet/RuView · error · ValueError

Unsupported hardware type: {self.hardware_type}

Error message

Unsupported hardware type: {self.hardware_type}

What it means

CSIExtractor.__init__ builds its parser from config['hardware_type'] and knows exactly two values: 'esp32' (optionally with parser_format='binary' for ADR-018 frames) and 'router'; anything else raises ValueError('Unsupported hardware type: ...') at construction time, before any connection is attempted.

Source

Thrown at archive/v1/src/hardware/csi_extractor.py:458

        self.buffer_size = config['buffer_size']
        self.timeout = config['timeout']
        self.validation_enabled = config.get('validation_enabled', True)
        self.retry_attempts = config.get('retry_attempts', 3)
        
        # State management
        self.is_connected = False
        self.is_streaming = False
        
        # Create appropriate parser
        if self.hardware_type == 'esp32':
            if config.get('parser_format') == 'binary':
                self.parser = ESP32BinaryParser()
            else:
                self.parser = ESP32CSIParser()
        elif self.hardware_type == 'router':
            self.parser = RouterCSIParser()
        else:
            raise ValueError(f"Unsupported hardware type: {self.hardware_type}")
    
    def _validate_config(self, config: Dict[str, Any]) -> None:
        """Validate configuration parameters.
        
        Args:
            config: Configuration to validate
            
        Raises:
            ValueError: If configuration is invalid
        """
        required_fields = ['hardware_type', 'sampling_rate', 'buffer_size', 'timeout']
        missing_fields = [field for field in required_fields if field not in config]
        
        if missing_fields:
            raise ValueError(f"Missing required configuration: {missing_fields}")
        
        if config['sampling_rate'] <= 0:
            raise ValueError("sampling_rate must be positive")

View on GitHub (pinned to 4685618388)

Solutions

  1. Set hardware_type exactly to 'esp32' or 'router' (lowercase); for ESP32 binary frames also set parser_format='binary'
  2. Validate config['hardware_type'] against the supported set before constructing CSIExtractor (see validationCode)
  3. If genuinely adding new hardware, extend the factory in __init__ and contribute a parser for it

Example fix

# before
extractor = CSIExtractor({'hardware_type': 'ESP32', ...})  # ValueError

# after
extractor = CSIExtractor({'hardware_type': 'esp32', 'parser_format': 'binary', ...})
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED_HARDWARE = {'esp32', 'router'}

hw = str(config.get('hardware_type', '')).lower()
if hw not in SUPPORTED_HARDWARE:
    raise ValueError(f'Unsupported hardware type: {config.get("hardware_type")!r}; expected one of {sorted(SUPPORTED_HARDWARE)}')
config['hardware_type'] = hw

Type guard

from typing import Any

def is_supported_hardware(value: Any) -> bool:
    return isinstance(value, str) and value.lower() in {'esp32', 'router'}

Try / catch

try:
    extractor = CSIExtractor(config)
except ValueError as e:
    raise SystemExit(f'config error: {e}') from e

Prevention

When it happens

Trigger: config hardware_type='ESP32' (uppercase), 'esp_32', 'wifi', 'atheros', None, or a misspelled value; a UI dropdown storing a display label instead of the machine value; a renamed key from a config refactor.

Common situations: Case or spelling drift between config files and the parser factory; new hardware added to the deployment but not to the code; configs hand-edited on the device.

Related errors


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