{"record":{"id":"948c152dcb5be264","repo":"ruvnet/RuView","slug":"missing-required-configuration-missing-fields-948c15","errorCode":null,"errorMessage":"Missing required configuration: {missing_fields}","messagePattern":"Missing required configuration: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"archive/v1/src/hardware/csi_extractor.py","lineNumber":473,"sourceCode":"        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\")\n        \n        if config['buffer_size'] <= 0:\n            raise ValueError(\"buffer_size must be positive\")\n        \n        if config['timeout'] <= 0:\n            raise ValueError(\"timeout must be positive\")\n    \n    async def connect(self) -> bool:\n        \"\"\"Establish connection to CSI hardware.\n        \n        Returns:\n            True if connection successful, False otherwise\n        \"\"\"\n        try:\n            success = await self._establish_hardware_connection()","sourceCodeStart":455,"sourceCodeEnd":491,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/archive/v1/src/hardware/csi_extractor.py#L455-L491","documentation":"CSIExtractor._validate_config requires four keys — hardware_type, sampling_rate, buffer_size, timeout — and raises ValueError listing the missing ones. It is a fail-fast completeness check run at construction, so a partial YAML/JSON config or a programmatically built dict missing any field aborts before hardware setup.","triggerScenarios":"A config file that omits timeout (or any of the four keys); a merge step dropping a key; copying a minimal example config that only shows a subset of required fields.","commonSituations":"Example configs showing only a few keys; refactors renaming keys (e.g. rate to sampling_rate) leaving stale keys in existing user configs; expecting implicit defaults that the extractor does not provide.","solutions":["Add all four keys with valid values to the extractor config (see exampleFix)","Pre-check completeness with the same key list before constructing CSIExtractor (see validationCode)","Centralize config defaults in one loader so every source produces the full key set"],"exampleFix":"# before\nconfig = {'hardware_type': 'esp32', 'sampling_rate': 100}  # ValueError: Missing required configuration: ['buffer_size', 'timeout']\n\n# after\nconfig = {\n    'hardware_type': 'esp32',\n    'sampling_rate': 100,\n    'buffer_size': 1024,\n    'timeout': 5.0,\n}","handlingStrategy":"validation","validationCode":"REQUIRED = ('hardware_type', 'sampling_rate', 'buffer_size', 'timeout')\n\ndef validate_extractor_config(config: dict) -> None:\n    missing = [k for k in REQUIRED if k not in config]\n    if missing:\n        raise ValueError(f'Missing required configuration: {missing}')","typeGuard":"def is_complete_config(config) -> bool:\n    return isinstance(config, dict) and all(k in config for k in ('hardware_type', 'sampling_rate', 'buffer_size', 'timeout'))","tryCatchPattern":"try:\n    extractor = CSIExtractor(config)\nexcept ValueError as e:\n    raise SystemExit(f'extractor config invalid: {e}') from e","preventionTips":["Validate the four required keys at config load with the same key list the extractor uses","Keep one canonical config template containing every required key","After config refactors, grep old key names in deployment configs to catch stale fields"],"tags":["configuration","validation","setup"],"backgroundTag":null,"analyzedSha":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}