{"record":{"id":"97c94d973929005b","repo":"ruvnet/RuView","slug":"unsupported-router-type-router-type","errorCode":null,"errorMessage":"Unsupported router type: {router_type}","messagePattern":"Unsupported router type: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"plans/phase2-architecture/hardware-integration.md","lineNumber":150,"sourceCode":"                'monitor_mode': True,\n                'channel_width': 20,  # MHz\n                'antenna_config': '3x3'\n            },\n            'intel5300': {\n                'firmware': 'linux-native',\n                'csi_tool': 'linux-80211n-csitool',\n                'extraction_rate': 1000,  # Hz\n                'connector_type': 'file',\n                'log_path': '/tmp/csi.dat',\n                'antenna_config': '3x3'\n            }\n        }\n    \n    def configure_router(self, router_type, router_ip):\n        \"\"\"Configure router for CSI extraction\"\"\"\n        config = self.router_configs.get(router_type)\n        if not config:\n            raise ValueError(f\"Unsupported router type: {router_type}\")\n        \n        if config['firmware'] == 'openwrt':\n            return self._configure_openwrt_router(router_ip, config)\n        elif config['firmware'] == 'linux-native':\n            return self._configure_intel_nic(config)\n    \n    def _configure_openwrt_router(self, router_ip, config):\n        \"\"\"Configure OpenWRT-based router\"\"\"\n        commands = [\n            # Enable monitor mode\n            f\"iw dev wlan0 interface add mon0 type monitor\",\n            f\"ifconfig mon0 up\",\n            \n            # Configure CSI extraction\n            f\"echo 1 > /sys/kernel/debug/ieee80211/phy0/ath9k/csi_enable\",\n            f\"echo {config['extraction_rate']} > /sys/kernel/debug/ieee80211/phy0/ath9k/csi_rate\",\n            \n            # Start UDP streaming","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/plans/phase2-architecture/hardware-integration.md#L132-L168","documentation":"ValueError from configure_router when router_type is not a key in the router_configs dict (whose entries include the Intel 5300/linux-80211n-csitool config and other per-firmware profiles). It is a pure configuration-lookup failure: the requested hardware profile was never registered.","triggerScenarios":"Calling configure_router('intel_5300') when the dict key is 'intel5300'; passing a router family the class simply does not support (no matching firmware profile); case or hyphen mismatches; new hardware added to the deployment but not to router_configs.","commonSituations":"Ops scripts hardcoding router model strings that drift from the code's keys; bringing up a new site with unsupported hardware; refactors that renamed config keys while old automation kept the previous spelling.","solutions":["Print/call list(self.router_configs.keys()) and pass one of those exact keys","If the hardware is genuinely new, add a matching entry to router_configs with firmware, csi_tool, and antenna config, plus the corresponding _configure_* branch","Normalize input (lowercase/strip) before lookup to survive cosmetic differences","Catch the ValueError and fail the provisioning run with the supported-types list in the message"],"exampleFix":"# before\nrouter.configure_router('Intel-5300', '192.168.1.1')  # ValueError: Unsupported router type\n\n# after\nrouter_type = 'Intel-5300'.lower()\nif router_type not in router.router_configs:\n    raise SystemExit(f'unsupported router; choose from {sorted(router.router_configs)}')\nrouter.configure_router(router_type, '192.168.1.1')","handlingStrategy":"validation","validationCode":"supported = set(router.router_configs)\nif router_type.lower() not in supported:\n    raise SystemExit(f'unsupported router type {router_type!r}; choose from {sorted(supported)}')\nrouter.configure_router(router_type.lower(), router_ip)","typeGuard":"def is_supported_router(manager, router_type: str) -> bool:\n    return router_type.lower() in manager.router_configs","tryCatchPattern":"try:\n    router.configure_router(router_type, router_ip)\nexcept ValueError as e:\n    if 'Unsupported router type' in str(e):\n        logging.error('supported types: %s', sorted(router.router_configs))\n    raise","preventionTips":["Derive router-type lists from router_configs.keys() in ops scripts instead of hardcoding strings","Normalize casing/whitespace before the lookup","When adding hardware, register the config entry and the _configure_* branch in the same change"],"tags":["python","hardware","csi","configuration","validation"],"backgroundTag":null,"analyzedSha":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}