ruvnet/RuView · error · ValueError
timeout must be positive
Error message
timeout must be positive
What it means
CSIExtractor._validate_config rejects config['timeout'] <= 0 with ValueError('timeout must be positive'). The timeout bounds reads/connections, and zero or negative would make every read a non-blocking poll, so it is rejected up front at construction.
Source
Thrown at archive/v1/src/hardware/csi_extractor.py:482
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 False
async def disconnect(self) -> None:
"""Disconnect from CSI hardware."""View on GitHub (pinned to 4685618388)
Solutions
- Set a positive timeout in the expected unit (seconds), e.g. 5.0
- Pre-validate all numeric config fields before constructing CSIExtractor (see validationCode)
- Keep one canonical config template with valid values for every required field
Example fix
# before
config = {'hardware_type': 'esp32', 'sampling_rate': 100, 'buffer_size': 1024, 'timeout': 0}
# after
config = {'hardware_type': 'esp32', 'sampling_rate': 100, 'buffer_size': 1024, 'timeout': 5.0} Defensive patterns
Strategy: validation
Validate before calling
if 'timeout' not in config or not isinstance(config['timeout'], (int, float)) or config['timeout'] <= 0:
raise ValueError('timeout must be a positive number (seconds)') 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
- Express timeouts in seconds as positive floats (e.g. 5.0); avoid int-casting loaders that turn 0.5 into 0
- Validate timeout with the same positive-number check used for sampling_rate
- 0 meaning 'no timeout' in other tools does not apply here — substitute a real bound
When it happens
Trigger: timeout: 0 copied from a non-blocking prototype config; a negative value; a unit mismatch where a millisecond value of 0 (or a fraction configured as 0 by an int-casting loader) reaches the extractor.
Common situations: Timeouts specified in the wrong unit or cast to int too early; configs migrated from tools that allow 0 to mean 'no timeout'; per-environment overrides never validated.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Missing required configuration: {missing_fields}
- sampling_rate must be positive
- buffer_size 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/7af3d8dea49d1bb3.
Report an issue: GitHub.