HKUDS/nanobot · error · RuntimeError

Matrix client is not started

Error message

Matrix client is not started

What it means

Error "Matrix client is not started" thrown in HKUDS/nanobot.

Source

Thrown at nanobot/channels/matrix/runtime.py:409

        elif self.config.access_token and self.config.device_id:
            try:
                self.client.user_id = self.config.user_id
                self.client.access_token = self.config.access_token
                self.client.device_id = self.config.device_id
                self.client.load_store()
                self.logger.info("Successfully loaded from existing session")
            except Exception as e:
                self.logger.warning("Failed to load from existing session: {}", e)

        else:
            self.logger.warning("Unable to load a session due to missing password, access_token, or device_id; encryption may not work")
            return

        self._sync_task = asyncio.create_task(self._sync_loop())

    def _require_client(self) -> AsyncClient:
        if self.client is None:
            raise RuntimeError("Matrix client is not started")
        return self.client

    def _callback_registrar(self) -> _MatrixCallbackRegistrar:
        # matrix-nio's callback annotations do not model filtered subtype or
        # async handlers, although the runtime API supports both.
        return cast(_MatrixCallbackRegistrar, self._require_client())

    async def stop(self) -> None:
        """Stop the Matrix channel with graceful sync shutdown."""
        self._running = False
        for room_id in list(self._typing_tasks):
            await self._stop_typing_keepalive(room_id, clear_typing=False)
        if self.client:
            self.client.stop_sync_forever()
        if self._sync_task:
            try:
                await asyncio.wait_for(asyncio.shield(self._sync_task),
                                       timeout=self.config.sync_stop_grace_seconds)

View on GitHub (pinned to 42f37dc4c0)

When it happens

Trigger: Thrown at nanobot/channels/matrix/runtime.py:409 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of HKUDS/nanobot@42f37dc4c0 (2026-08-26). Data as JSON: /api/errors/705851c8c20b6d95. Report an issue: GitHub.