{"record":{"id":"9615464343df54e4","repo":"ruvnet/RuView","slug":"unsupported-hardware-type-self-hardware-type","errorCode":null,"errorMessage":"Unsupported hardware type: {self.hardware_type}","messagePattern":"Unsupported hardware type: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"archive/v1/src/hardware/csi_extractor.py","lineNumber":458,"sourceCode":"        self.buffer_size = config['buffer_size']\n        self.timeout = config['timeout']\n        self.validation_enabled = config.get('validation_enabled', True)\n        self.retry_attempts = config.get('retry_attempts', 3)\n        \n        # State management\n        self.is_connected = False\n        self.is_streaming = False\n        \n        # Create appropriate parser\n        if self.hardware_type == 'esp32':\n            if config.get('parser_format') == 'binary':\n                self.parser = ESP32BinaryParser()\n            else:\n                self.parser = ESP32CSIParser()\n        elif self.hardware_type == 'router':\n            self.parser = RouterCSIParser()\n        else:\n            raise ValueError(f\"Unsupported hardware type: {self.hardware_type}\")\n    \n    def _validate_config(self, config: Dict[str, Any]) -> None:\n        \"\"\"Validate configuration parameters.\n        \n        Args:\n            config: Configuration to validate\n            \n        Raises:\n            ValueError: If configuration is invalid\n        \"\"\"\n        required_fields = ['hardware_type', 'sampling_rate', 'buffer_size', 'timeout']\n        missing_fields = [field for field in required_fields if field not in config]\n        \n        if missing_fields:\n            raise ValueError(f\"Missing required configuration: {missing_fields}\")\n        \n        if config['sampling_rate'] <= 0:\n            raise ValueError(\"sampling_rate must be positive\")","sourceCodeStart":440,"sourceCodeEnd":476,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/archive/v1/src/hardware/csi_extractor.py#L440-L476","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set hardware_type exactly to 'esp32' or 'router' (lowercase); for ESP32 binary frames also set parser_format='binary'","Validate config['hardware_type'] against the supported set before constructing CSIExtractor (see validationCode)","If genuinely adding new hardware, extend the factory in __init__ and contribute a parser for it"],"exampleFix":"# before\nextractor = CSIExtractor({'hardware_type': 'ESP32', ...})  # ValueError\n\n# after\nextractor = CSIExtractor({'hardware_type': 'esp32', 'parser_format': 'binary', ...})","handlingStrategy":"validation","validationCode":"SUPPORTED_HARDWARE = {'esp32', 'router'}\n\nhw = str(config.get('hardware_type', '')).lower()\nif hw not in SUPPORTED_HARDWARE:\n    raise ValueError(f'Unsupported hardware type: {config.get(\"hardware_type\")!r}; expected one of {sorted(SUPPORTED_HARDWARE)}')\nconfig['hardware_type'] = hw","typeGuard":"from typing import Any\n\ndef is_supported_hardware(value: Any) -> bool:\n    return isinstance(value, str) and value.lower() in {'esp32', 'router'}","tryCatchPattern":"try:\n    extractor = CSIExtractor(config)\nexcept ValueError as e:\n    raise SystemExit(f'config error: {e}') from e","preventionTips":["Normalize hardware_type to lowercase and validate against {'esp32', 'router'} at config load","Store machine values, not display labels, in config files and UI dropdowns","Fail fast at startup with the allowed-value list instead of constructing the extractor blind"],"tags":["configuration","hardware","validation","factory"],"backgroundTag":null,"analyzedSha":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}