ruvnet/RuView · error · RuntimeError

Pose service is not running

Error message

Pose service is not running

What it means

PoseService.process_csi_data() guards on the is_running flag, which start() sets True and stop() sets False. Processing CSI data before start(), after stop(), or on a freshly constructed service raises RuntimeError immediately. This is purely a lifecycle-ordering error: the estimator itself may be fine, the service simply is not in the active state.

Source

Thrown at archive/v1/src/services/pose_service.py:163

            raise
    
    async def start(self):
        """Start the pose service."""
        if not self.is_initialized:
            await self.initialize()
        
        self.is_running = True
        self.logger.info("Pose service started")
    
    async def stop(self):
        """Stop the pose service."""
        self.is_running = False
        self.logger.info("Pose service stopped")
    
    async def process_csi_data(self, csi_data: np.ndarray, metadata: Dict[str, Any]) -> Dict[str, Any]:
        """Process CSI data and estimate poses."""
        if not self.is_running:
            raise RuntimeError("Pose service is not running")
        
        start_time = datetime.now()
        
        try:
            # Process CSI data
            processed_csi = await self._process_csi(csi_data, metadata)
            
            # Estimate poses
            poses = await self._estimate_poses(processed_csi, metadata)
            
            # Update statistics
            processing_time = (datetime.now() - start_time).total_seconds() * 1000
            self._update_stats(poses, processing_time)
            
            return {
                "timestamp": start_time.isoformat(),
                "poses": poses,
                "metadata": metadata,

View on GitHub (pinned to 4685618388)

Solutions

  1. Await 'await pose_service.start()' before the first process_csi_data call.
  2. Add lifecycle guards in callers: only forward CSI when pose_service.is_running is True.
  3. In shutdown paths, stop the CSI producers before stopping the pose service so no calls race the flag.
  4. Expose a 503-style response at the API layer when the service is not running instead of letting RuntimeError bubble.

Example fix

# before
result = await pose_service.process_csi_data(csi, metadata)  # RuntimeError

# after
if not pose_service.is_running:
    await pose_service.start()
result = await pose_service.process_csi_data(csi, metadata)
Defensive patterns

Strategy: validation

Validate before calling

if not pose_service.is_running:
    await pose_service.start()
result = await pose_service.process_csi_data(csi, metadata)

Prevention

When it happens

Trigger: Calling process_csi_data(csi, metadata) on a new PoseService instance without awaiting start(); feeding CSI from a callback after the service was stopped during shutdown; tests that construct the service but skip the startup fixture.

Common situations: Pipeline wiring where the CSI ingestion starts before pose service startup completes; shutdown races where queued CSI batches arrive after stop(); unit tests missing async setup.

Related errors


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