{"record":{"id":"07a334030b6690fe","repo":"HKUDS/nanobot","slug":"napcat-not-connected","errorCode":null,"errorMessage":"napcat: not connected","messagePattern":"napcat: not connected","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"nanobot/channels/napcat/runtime.py","lineNumber":441,"sourceCode":"        try:\n            resp = await self._call_action(\n                \"get_group_member_info\",\n                {\"group_id\": group_id, \"user_id\": user_id, \"no_cache\": True},\n            )\n            data = resp.get(\"data\", {})\n            # logger.debug(\"get_group_member_info: {}\", resp)\n            return data.get(\"card\") or data.get(\"nickname\") or str(user_id)\n        except Exception as e:\n            logger.warning(\"napcat: get_group_member_info failed: {}\", e)\n            return str(user_id)\n\n    # ------------------------------------------------------------------\n    # Outbound\n    # ------------------------------------------------------------------\n\n    async def send(self, msg: OutboundMessage) -> None:\n        if self._ws is None:\n            raise RuntimeError(\"napcat: not connected\")\n\n        kind, _, target = msg.chat_id.partition(\":\")\n        if kind not in (\"private\", \"group\") or not target:\n            logger.error(\"napcat: invalid chat_id '{}'\", msg.chat_id)\n            return\n\n        segments: list[dict[str, Any]] = []\n        for ref in msg.media or []:\n            if seg := await self._build_image_segment(ref):\n                segments.append(seg)\n        if text := (msg.content or \"\").strip():\n            segments.append({\"type\": \"text\", \"data\": {\"text\": text}})\n        if not segments:\n            return\n\n        params: dict[str, Any] = {\"message\": segments}\n        if kind == \"group\":\n            params[\"message_type\"] = \"group\"","sourceCodeStart":423,"sourceCodeEnd":459,"githubUrl":"https://github.com/HKUDS/nanobot/blob/42f37dc4c0e409eac7818a82d165c5f2757bc075/nanobot/channels/napcat/runtime.py#L423-L459","documentation":"Sentinel guard in _call_action: the NapCat/OneBot WebSocket is None (never started or already stopped), so the QQ action request cannot be sent. Fires when send() or member lookup is attempted before the websocket connection is established.","triggerScenarios":"Thrown at nanobot/channels/napcat/runtime.py:441 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the channel's start() has completed and the NapCat WebSocket is connected before sending","Check NapCat server availability and the configured WebSocket endpoint","Retry after the connection reconnect loop re-establishes the socket"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"42f37dc4c0e409eac7818a82d165c5f2757bc075","analyzedAt":"2026-08-26T00:18:52.276Z","contentChangedAt":"2026-08-26T00:18:52.276Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}