ruvnet/RuView · error · ValueError
sampling_rate must be positive
Error message
sampling_rate must be positive
What it means
CSIExtractor._validate_config rejects config['sampling_rate'] <= 0 with ValueError('sampling_rate must be positive'). The rate drives acquisition cadence, so zero (a common 'unset' sentinel) and negative values are treated as invalid configuration rather than defaulted.
Source
Thrown at archive/v1/src/hardware/csi_extractor.py:476
raise ValueError(f"Unsupported hardware type: {self.hardware_type}")
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 = ['hardware_type', 'sampling_rate', 'buffer_size', 'timeout']
missing_fields = [field for field in required_fields if field not in config]
if missing_fields:
raise ValueError(f"Missing required configuration: {missing_fields}")
if config['sampling_rate'] <= 0:
raise ValueError("sampling_rate must be positive")
if config['buffer_size'] <= 0:
raise ValueError("buffer_size must be positive")
if config['timeout'] <= 0:
raise ValueError("timeout must be positive")
async def connect(self) -> bool:
"""Establish connection to CSI hardware.
Returns:
True if connection successful, False otherwise
"""
try:
success = await self._establish_hardware_connection()
self.is_connected = success
return success
except Exception as e:View on GitHub (pinned to 4685618388)
Solutions
- Set a positive rate matching the hardware (e.g. 100 for a ~100 Hz CSI stream)
- Resolve 'unset' sentinels to real defaults at the config-loading layer before constructing CSIExtractor
- Validate numeric config fields against the same constraints with a helper before construction
Example fix
# before
config = {'hardware_type': 'esp32', 'sampling_rate': 0, 'buffer_size': 1024, 'timeout': 5.0}
# after
config = {'hardware_type': 'esp32', 'sampling_rate': 100, 'buffer_size': 1024, 'timeout': 5.0} Defensive patterns
Strategy: validation
Validate before calling
if 'sampling_rate' not in config or not isinstance(config['sampling_rate'], (int, float)) or config['sampling_rate'] <= 0:
raise ValueError('sampling_rate must be a positive number') Type guard
def is_positive_number(value) -> bool:
return isinstance(value, (int, float)) and not isinstance(value, bool) and value > 0 Try / catch
try:
extractor = CSIExtractor(config)
except ValueError as e:
raise SystemExit(f'extractor config invalid: {e}') from e Prevention
- Resolve 0/'auto' sentinels to concrete positive defaults in the config loader
- Validate numeric fields with a shared is_positive_number helper before extractor construction
- Document the expected unit (Hz) next to the key in config templates
When it happens
Trigger: sampling_rate: 0 in a config used before tuning; a negative value from a bad calculation or typo; a derived rate that computed to 0 (e.g. division that underflowed a configured expression).
Common situations: Config templates using 0 to mean 'auto' where no auto mode exists; values copied from a different tool with different units; environment-specific configs never revisited.
Related errors
- Missing required configuration: {missing_fields}
- buffer_size must be positive
- timeout must be positive
- Unsupported host: ${name}
- Unsupported hardware type: {self.hardware_type}
AI-assisted analysis of ruvnet/RuView@4685618388 (2026-08-16).
Data as JSON: /api/errors/35403bf9be5da3b0.
Report an issue: GitHub.