{"record":{"id":"a96b127d5e267d21","repo":"HKUDS/nanobot","slug":"msteams-conversation-ref-not-found-for-chat-id-ms","errorCode":null,"errorMessage":"MSTeams conversation ref not found for chat_id={msg.chat_id}","messagePattern":"MSTeams conversation ref not found for chat_id=(.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"nanobot/channels/msteams/runtime.py","lineNumber":258,"sourceCode":"        if self._server:\n            self._server.shutdown()\n            self._server.server_close()\n            self._server = None\n        if self._server_thread and self._server_thread.is_alive():\n            self._server_thread.join(timeout=2)\n        self._server_thread = None\n        if self._http:\n            await self._http.aclose()\n            self._http = None\n\n    async def send(self, msg: OutboundMessage) -> None:\n        \"\"\"Send a plain text reply into an existing Teams conversation.\"\"\"\n        if not self._http:\n            raise RuntimeError(\"MSTeams HTTP client not initialized\")\n\n        ref = self._conversation_refs.get(str(msg.chat_id))\n        if not ref:\n            raise RuntimeError(f\"MSTeams conversation ref not found for chat_id={msg.chat_id}\")\n\n        if not self._is_trusted_service_url(ref.service_url):\n            raise RuntimeError(\n                f\"MSTeams conversation ref has untrusted service_url for chat_id={msg.chat_id}\"\n            )\n\n        token = await self._get_access_token()\n        base_url = f\"{ref.service_url.rstrip('/')}/v3/conversations/{ref.conversation_id}/activities\"\n        use_thread_reply = self.config.reply_in_thread and bool(ref.activity_id)\n        headers = {\n            \"Authorization\": f\"Bearer {token}\",\n            \"Content-Type\": \"application/json\",\n        }\n        payload = {\n            \"type\": \"message\",\n            \"text\": msg.content or \" \",\n        }\n        if use_thread_reply:","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/HKUDS/nanobot/blob/42f37dc4c0e409eac7818a82d165c5f2757bc075/nanobot/channels/msteams/runtime.py#L240-L276","documentation":"Error \"MSTeams conversation ref not found for chat_id={msg.chat_id}\" thrown in HKUDS/nanobot.","triggerScenarios":"Thrown at nanobot/channels/msteams/runtime.py:258 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"}