{"record":{"id":"4371f265181595cd","repo":"ruvnet/RuView","slug":"missing-required-configuration-missing-fields-4371f2","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/phase_sanitizer.py","lineNumber":63,"sourceCode":"        # Statistics tracking\n        self._total_processed = 0\n        self._outliers_removed = 0\n        self._sanitization_errors = 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 = ['unwrapping_method', 'outlier_threshold', 'smoothing_window']\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        # Validate unwrapping method\n        valid_methods = ['numpy', 'scipy', 'custom']\n        if config['unwrapping_method'] not in valid_methods:\n            raise ValueError(f\"Invalid unwrapping method: {config['unwrapping_method']}. Must be one of {valid_methods}\")\n        \n        # Validate thresholds\n        if config['outlier_threshold'] <= 0:\n            raise ValueError(\"outlier_threshold must be positive\")\n        \n        if config['smoothing_window'] <= 0:\n            raise ValueError(\"smoothing_window must be positive\")\n    \n    def unwrap_phase(self, phase_data: np.ndarray) -> np.ndarray:\n        \"\"\"Unwrap phase data to remove discontinuities.\n        \n        Args:\n            phase_data: Wrapped phase data (2D array)","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/archive/v1/src/core/phase_sanitizer.py#L45-L81","documentation":"Raised by PhaseSanitizer._validate_config from __init__ (archive/v1/src/core/phase_sanitizer.py). The config dict must contain unwrapping_method, outlier_threshold, and smoothing_window; optional keys like enable_smoothing have defaults. The missing key list is interpolated into the message, telling you exactly what to add.","triggerScenarios":"Constructing PhaseSanitizer(config) with a dict missing one or more required keys, e.g. PhaseSanitizer({'unwrapping_method': 'numpy'}) without outlier_threshold and smoothing_window. Misspelled or camelCase keys also count as missing because the check is exact key membership.","commonSituations":"Config files shared with CSIProcessor that assume phase defaults exist (they do not — all three are required); schema drift between pipeline versions; minimal dicts in quick scripts; JSON configs where a key was renamed during editing; tests constructing partial configs.","solutions":["Add the named missing keys: {'unwrapping_method': 'numpy', 'outlier_threshold': 3.0, 'smoothing_window': 5} is a typical starting config.","Verify exact snake_case spelling of all three keys.","If loading from YAML/JSON, assert the required set before constructing (see validationCode).","Reuse a single validated config template across the pipeline instead of ad-hoc dicts."],"exampleFix":"# before\nsanitizer = PhaseSanitizer({'unwrapping_method': 'numpy'})\n# ValueError: Missing required configuration: ['outlier_threshold', 'smoothing_window']\n\n# after\nsanitizer = PhaseSanitizer({\n    'unwrapping_method': 'numpy',\n    'outlier_threshold': 3.0,\n    'smoothing_window': 5,\n})","handlingStrategy":"validation","validationCode":"REQUIRED_SANITIZER_KEYS = {'unwrapping_method', 'outlier_threshold', 'smoothing_window'}\n\ndef is_valid_sanitizer_config(config: dict) -> bool:\n    return REQUIRED_SANITIZER_KEYS.issubset(config)","typeGuard":"from typing import TypeGuard\n\nREQUIRED_SANITIZER_KEYS = ('unwrapping_method', 'outlier_threshold', 'smoothing_window')\n\ndef has_required_sanitizer_keys(config: dict) -> TypeGuard[dict]:\n    return all(k in config for k in REQUIRED_SANITIZER_KEYS)","tryCatchPattern":"try:\n    sanitizer = PhaseSanitizer(config)\nexcept ValueError as e:\n    if str(e).startswith('Missing required configuration'):\n        raise ValueError(f'Phase sanitizer config needs {REQUIRED_SANITIZER_KEYS}') from e\n    raise","preventionTips":["Keep one reviewed phase-sanitizer config block in the shared pipeline config file.","Reuse the same key names as CSIProcessor configs (snake_case, exact match).","Assert required keys right after loading YAML/JSON, before any object construction."],"tags":["config","validation","phase-sanitizer","constructor"],"backgroundTag":null,"analyzedSha":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}