{"record":{"id":"bfa97fee92c90d5d","repo":"ruvnet/RuView","slug":"invalid-unwrapping-method-config-unwrapping-met","errorCode":null,"errorMessage":"Invalid unwrapping method: {config['unwrapping_method']}. Must be one of {valid_methods}","messagePattern":"Invalid unwrapping method: (.+?)\\. Must be one of (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"archive/v1/src/core/phase_sanitizer.py","lineNumber":68,"sourceCode":"    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)\n            \n        Returns:\n            Unwrapped phase data\n            \n        Raises:","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/archive/v1/src/core/phase_sanitizer.py#L50-L86","documentation":"Raised by PhaseSanitizer._validate_config when unwrapping_method is present but not one of the allowed strings 'numpy', 'scipy', 'custom'. The message lists both the invalid value and the valid set, so it is self-diagnosing. This fires at construction time, before any phase data is processed.","triggerScenarios":"Constructing PhaseSanitizer with unwrapping_method set to anything else: 'np', 'numpy.unwrap', 'scipy_unwrap', 'NONE', 'Numpy' (case-sensitive), or None. Case mismatch is the most common variant because the whitelist is lowercase.","commonSituations":"Abbreviations or fully-qualified function names used instead of the short alias; config generated from an enum whose serialization differs ('UnwrapMethod.NUMPY'); case differences from user-edited YAML; copy-paste from docs of a different version listing different method names; None used to skip unwrapping (not supported — there is no 'none' method).","solutions":["Use exactly one of: 'numpy', 'scipy', or 'custom'.","Normalize case before construction: `config['unwrapping_method'] = config['unwrapping_method'].lower()` (after confirming the value is a string).","If you do not want unwrapping, skip calling unwrap_phase rather than inventing a method name.","Pin the allowed set in a constant shared by config generators and tests."],"exampleFix":"# before\nsanitizer = PhaseSanitizer({'unwrapping_method': 'Numpy', 'outlier_threshold': 3.0, 'smoothing_window': 5})\n# ValueError: Invalid unwrapping method: Numpy. Must be one of ['numpy', 'scipy', 'custom']\n\n# after\nsanitizer = PhaseSanitizer({'unwrapping_method': 'numpy', 'outlier_threshold': 3.0, 'smoothing_window': 5})","handlingStrategy":"validation","validationCode":"VALID_METHODS = ('numpy', 'scipy', 'custom')\n\ndef normalized_method(value) -> str:\n    v = str(value).strip().lower()\n    if v not in VALID_METHODS:\n        raise ValueError(f'unwrapping_method must be one of {VALID_METHODS}, got {value!r}')\n    return v\n\nconfig['unwrapping_method'] = normalized_method(config['unwrapping_method'])","typeGuard":"from typing import TypeGuard\n\nVALID_METHODS = ('numpy', 'scipy', 'custom')\n\ndef is_valid_unwrap_method(value: object) -> TypeGuard[str]:\n    return isinstance(value, str) and value in VALID_METHODS","tryCatchPattern":"try:\n    sanitizer = PhaseSanitizer(config)\nexcept ValueError as e:\n    if 'Invalid unwrapping method' in str(e):\n        config['unwrapping_method'] = 'numpy'\n        sanitizer = PhaseSanitizer(config)\n    else:\n        raise","preventionTips":["Normalize case and whitespace on the config boundary (lower/strip).","Use a shared constant tuple for the whitelist in generators, docs, and tests.","There is no 'none' method — skip unwrap_phase entirely if unwrapping is unwanted."],"tags":["config","validation","phase-sanitizer","enum"],"backgroundTag":null,"analyzedSha":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}