{"record":{"id":"985e1933451a0dda","repo":"ruvnet/RuView","slug":"pose-service-is-not-running","errorCode":null,"errorMessage":"Pose service is not running","messagePattern":"Pose service is not running","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"archive/v1/src/services/pose_service.py","lineNumber":163,"sourceCode":"            raise\n    \n    async def start(self):\n        \"\"\"Start the pose service.\"\"\"\n        if not self.is_initialized:\n            await self.initialize()\n        \n        self.is_running = True\n        self.logger.info(\"Pose service started\")\n    \n    async def stop(self):\n        \"\"\"Stop the pose service.\"\"\"\n        self.is_running = False\n        self.logger.info(\"Pose service stopped\")\n    \n    async def process_csi_data(self, csi_data: np.ndarray, metadata: Dict[str, Any]) -> Dict[str, Any]:\n        \"\"\"Process CSI data and estimate poses.\"\"\"\n        if not self.is_running:\n            raise RuntimeError(\"Pose service is not running\")\n        \n        start_time = datetime.now()\n        \n        try:\n            # Process CSI data\n            processed_csi = await self._process_csi(csi_data, metadata)\n            \n            # Estimate poses\n            poses = await self._estimate_poses(processed_csi, metadata)\n            \n            # Update statistics\n            processing_time = (datetime.now() - start_time).total_seconds() * 1000\n            self._update_stats(poses, processing_time)\n            \n            return {\n                \"timestamp\": start_time.isoformat(),\n                \"poses\": poses,\n                \"metadata\": metadata,","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/archive/v1/src/services/pose_service.py#L145-L181","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Await 'await pose_service.start()' before the first process_csi_data call.","Add lifecycle guards in callers: only forward CSI when pose_service.is_running is True.","In shutdown paths, stop the CSI producers before stopping the pose service so no calls race the flag.","Expose a 503-style response at the API layer when the service is not running instead of letting RuntimeError bubble."],"exampleFix":"# before\nresult = await pose_service.process_csi_data(csi, metadata)  # RuntimeError\n\n# after\nif not pose_service.is_running:\n    await pose_service.start()\nresult = await pose_service.process_csi_data(csi, metadata)","handlingStrategy":"validation","validationCode":"if not pose_service.is_running:\n    await pose_service.start()\nresult = await pose_service.process_csi_data(csi, metadata)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Start PoseService in the application lifespan before wiring CSI ingestion callbacks.","Gate CSI forwarding on pose_service.is_running so shutdown races cannot reach process_csi_data.","Order shutdown producers-first: stop CSI collectors, then the pose service."],"tags":["pose","service","lifecycle","asyncio"],"backgroundTag":null,"analyzedSha":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}