{"record":{"id":"3be6d567d3c92b66","repo":"ruvnet/RuView","slug":"missing-required-configuration-missing-fields","errorCode":null,"errorMessage":"Missing required configuration: {missing_fields}","messagePattern":"Missing required configuration: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"archive/v1/src/core/csi_processor.py","lineNumber":108,"sourceCode":"        # Statistics tracking\n        self._total_processed = 0\n        self._processing_errors = 0\n        self._human_detections = 0\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 = ['sampling_rate', 'window_size', 'overlap', 'noise_threshold']\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['window_size'] <= 0:\n            raise ValueError(\"window_size must be positive\")\n        \n        if not 0 <= config['overlap'] < 1:\n            raise ValueError(\"overlap must be between 0 and 1\")\n    \n    def preprocess_csi_data(self, csi_data: CSIData) -> CSIData:\n        \"\"\"Preprocess CSI data for feature extraction.\n        \n        Args:\n            csi_data: Raw CSI data\n            \n        Returns:\n            Preprocessed CSI data","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/archive/v1/src/core/csi_processor.py#L90-L126","documentation":"Raised by CSIProcessor._validate_config (archive/v1/src/core/csi_processor.py) from __init__, so it fires at construction time. The config dict must contain all four keys: sampling_rate, window_size, overlap, noise_threshold — other parameters like human_detection_threshold have defaults. The missing key names are interpolated into the message, so the text tells you exactly what to add.","triggerScenarios":"Calling CSIProcessor(config) with a dict missing one or more of the four required keys, e.g. CSIProcessor({'sampling_rate': 100, 'window_size': 64, 'overlap': 0.5}) without noise_threshold. Also happens when keys are present but misspelled ('windowSize', 'over_lap'), or when YAML/JSON config files use different key names than the code expects.","commonSituations":"Porting configs from an older pipeline version whose schema used different key names; building config from a dataclass or TypedDict and dropping a field; empty dict `CSIProcessor({})` in early scaffolding; config loaded from JSON where a key was renamed during a merge; tests constructing minimal configs.","solutions":["Add the listed missing keys to the config dict — the message names them, e.g. add 'noise_threshold': 0.1.","Start from the canonical shape: {'sampling_rate': 100, 'window_size': 64, 'overlap': 0.5, 'noise_threshold': 0.1} and then tune.","Check for exact key spelling and case; keys are snake_case and case-sensitive membership checks (`field not in config`).","If loading from file, validate the loaded dict against the required set before constructing (see validationCode)."],"exampleFix":"# before\nprocessor = CSIProcessor({'sampling_rate': 100, 'window_size': 64, 'overlap': 0.5})\n# ValueError: Missing required configuration: ['noise_threshold']\n\n# after\nprocessor = CSIProcessor({\n    'sampling_rate': 100,\n    'window_size': 64,\n    'overlap': 0.5,\n    'noise_threshold': 0.1,\n})","handlingStrategy":"validation","validationCode":"REQUIRED_CSI_KEYS = {'sampling_rate', 'window_size', 'overlap', 'noise_threshold'}\n\ndef is_valid_csi_config(config: dict) -> bool:\n    return REQUIRED_CSI_KEYS.issubset(config)","typeGuard":"from typing import TypeGuard\n\nREQUIRED_CSI_KEYS = ('sampling_rate', 'window_size', 'overlap', 'noise_threshold')\n\ndef has_required_keys(config: dict) -> TypeGuard[dict]:\n    return all(k in config for k in REQUIRED_CSI_KEYS)","tryCatchPattern":"try:\n    processor = CSIProcessor(config)\nexcept ValueError as e:\n    if str(e).startswith('Missing required configuration'):\n        missing = {'sampling_rate', 'window_size', 'overlap', 'noise_threshold'} - config.keys()\n        raise ValueError(f'Fill in {missing} in the CSI config') from e\n    raise","preventionTips":["Define one canonical config dict constant or load it from a reviewed YAML template.","Run a schema check (required keys present, positive numbers) right after loading config from any file.","Keep key names snake_case and copy them verbatim from the constructor docs."],"tags":["config","validation","csi-processing","constructor"],"backgroundTag":null,"analyzedSha":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}