ruvnet/RuView · error · ValueError

Missing required configuration: {missing_fields}

Error message

Missing required configuration: {missing_fields}

What it means

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.

Source

Thrown at archive/v1/src/core/phase_sanitizer.py:63

        # Statistics tracking
        self._total_processed = 0
        self._outliers_removed = 0
        self._sanitization_errors = 0
    
    def _validate_config(self, config: Dict[str, Any]) -> None:
        """Validate configuration parameters.
        
        Args:
            config: Configuration to validate
            
        Raises:
            ValueError: If configuration is invalid
        """
        required_fields = ['unwrapping_method', 'outlier_threshold', 'smoothing_window']
        missing_fields = [field for field in required_fields if field not in config]
        
        if missing_fields:
            raise ValueError(f"Missing required configuration: {missing_fields}")
        
        # Validate unwrapping method
        valid_methods = ['numpy', 'scipy', 'custom']
        if config['unwrapping_method'] not in valid_methods:
            raise ValueError(f"Invalid unwrapping method: {config['unwrapping_method']}. Must be one of {valid_methods}")
        
        # Validate thresholds
        if config['outlier_threshold'] <= 0:
            raise ValueError("outlier_threshold must be positive")
        
        if config['smoothing_window'] <= 0:
            raise ValueError("smoothing_window must be positive")
    
    def unwrap_phase(self, phase_data: np.ndarray) -> np.ndarray:
        """Unwrap phase data to remove discontinuities.
        
        Args:
            phase_data: Wrapped phase data (2D array)

View on GitHub (pinned to 4685618388)

Solutions

  1. Add the named missing keys: {'unwrapping_method': 'numpy', 'outlier_threshold': 3.0, 'smoothing_window': 5} is a typical starting config.
  2. Verify exact snake_case spelling of all three keys.
  3. If loading from YAML/JSON, assert the required set before constructing (see validationCode).
  4. Reuse a single validated config template across the pipeline instead of ad-hoc dicts.

Example fix

# before
sanitizer = PhaseSanitizer({'unwrapping_method': 'numpy'})
# ValueError: Missing required configuration: ['outlier_threshold', 'smoothing_window']

# after
sanitizer = PhaseSanitizer({
    'unwrapping_method': 'numpy',
    'outlier_threshold': 3.0,
    'smoothing_window': 5,
})
Defensive patterns

Strategy: validation

Validate before calling

REQUIRED_SANITIZER_KEYS = {'unwrapping_method', 'outlier_threshold', 'smoothing_window'}

def is_valid_sanitizer_config(config: dict) -> bool:
    return REQUIRED_SANITIZER_KEYS.issubset(config)

Type guard

from typing import TypeGuard

REQUIRED_SANITIZER_KEYS = ('unwrapping_method', 'outlier_threshold', 'smoothing_window')

def has_required_sanitizer_keys(config: dict) -> TypeGuard[dict]:
    return all(k in config for k in REQUIRED_SANITIZER_KEYS)

Try / catch

try:
    sanitizer = PhaseSanitizer(config)
except ValueError as e:
    if str(e).startswith('Missing required configuration'):
        raise ValueError(f'Phase sanitizer config needs {REQUIRED_SANITIZER_KEYS}') from e
    raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of ruvnet/RuView@4685618388 (2026-08-16). Data as JSON: /api/errors/4371f265181595cd. Report an issue: GitHub.