{"record":{"id":"705851c8c20b6d95","repo":"HKUDS/nanobot","slug":"matrix-client-is-not-started","errorCode":null,"errorMessage":"Matrix client is not started","messagePattern":"Matrix client is not started","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"nanobot/channels/matrix/runtime.py","lineNumber":409,"sourceCode":"        elif self.config.access_token and self.config.device_id:\n            try:\n                self.client.user_id = self.config.user_id\n                self.client.access_token = self.config.access_token\n                self.client.device_id = self.config.device_id\n                self.client.load_store()\n                self.logger.info(\"Successfully loaded from existing session\")\n            except Exception as e:\n                self.logger.warning(\"Failed to load from existing session: {}\", e)\n\n        else:\n            self.logger.warning(\"Unable to load a session due to missing password, access_token, or device_id; encryption may not work\")\n            return\n\n        self._sync_task = asyncio.create_task(self._sync_loop())\n\n    def _require_client(self) -> AsyncClient:\n        if self.client is None:\n            raise RuntimeError(\"Matrix client is not started\")\n        return self.client\n\n    def _callback_registrar(self) -> _MatrixCallbackRegistrar:\n        # matrix-nio's callback annotations do not model filtered subtype or\n        # async handlers, although the runtime API supports both.\n        return cast(_MatrixCallbackRegistrar, self._require_client())\n\n    async def stop(self) -> None:\n        \"\"\"Stop the Matrix channel with graceful sync shutdown.\"\"\"\n        self._running = False\n        for room_id in list(self._typing_tasks):\n            await self._stop_typing_keepalive(room_id, clear_typing=False)\n        if self.client:\n            self.client.stop_sync_forever()\n        if self._sync_task:\n            try:\n                await asyncio.wait_for(asyncio.shield(self._sync_task),\n                                       timeout=self.config.sync_stop_grace_seconds)","sourceCodeStart":391,"sourceCodeEnd":427,"githubUrl":"https://github.com/HKUDS/nanobot/blob/42f37dc4c0e409eac7818a82d165c5f2757bc075/nanobot/channels/matrix/runtime.py#L391-L427","documentation":"Error \"Matrix client is not started\" thrown in HKUDS/nanobot.","triggerScenarios":"Thrown at nanobot/channels/matrix/runtime.py:409 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"42f37dc4c0e409eac7818a82d165c5f2757bc075","analyzedAt":"2026-08-26T00:18:52.276Z","schemaVersion":2},"datasetVersion":"2026-08-26T04:18:47.238Z"}