ruvnet/RuView · error · ValueError
buffer_size must be positive
Error message
buffer_size must be positive
What it means
CSIExtractor._validate_config rejects config['buffer_size'] <= 0 with ValueError('buffer_size must be positive'). The buffer sizes acquisition storage between reads; zero or negative is a configuration error, and the extractor applies no implicit default.
Source
Thrown at archive/v1/src/hardware/csi_extractor.py:479
"""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:
self.logger.error(f"Failed to connect to hardware: {e}")
self.is_connected = False
return FalseView on GitHub (pinned to 4685618388)
Solutions
- Set a positive buffer size appropriate to the CSI rate (e.g. 1024 frames)
- If buffer_size is computed, clamp it to a minimum positive value before construction
- Pre-validate the config dict with a helper that mirrors the extractor's constraints
Example fix
# before
config = {'hardware_type': 'esp32', 'sampling_rate': 100, 'buffer_size': 0, '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 'buffer_size' not in config or not isinstance(config['buffer_size'], int) or config['buffer_size'] <= 0:
raise ValueError('buffer_size must be a positive integer') Type guard
def is_positive_int(value) -> bool:
return isinstance(value, int) 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
- Clamp computed buffer sizes to a minimum positive value before construction
- Never use -1 or 0 as 'unlimited' markers — the extractor has no such mode
- Share one config-validation helper across all deployments of CSIExtractor
When it happens
Trigger: buffer_size: 0 in a minimal config; a -1 'unlimited' sentinel; a computed buffer size (rate * seconds) that rounds or truncates to 0.
Common situations: Configs trimmed to the smallest working set; buffer sizes derived from formulas during experimentation; copying configs between deployments with different assumptions.
Related errors
- Missing required configuration: {missing_fields}
- sampling_rate 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/39d4a8c81016de50.
Report an issue: GitHub.