{"record":{"id":"80782e5636babcc7","repo":"HKUDS/nanobot","slug":"dingtalk-text-message-was-not-delivered","errorCode":null,"errorMessage":"DingTalk text message was not delivered","messagePattern":"DingTalk text message was not delivered","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"nanobot/channels/dingtalk/runtime.py","lineNumber":775,"sourceCode":"        token = await self._get_access_token()\n        if not token:\n            raise RuntimeError(\"DingTalk access token unavailable\")\n\n        content = msg.content.strip() if msg.content else \"\"\n        if content:\n            # In group chats, prefix the reply with a markdown header naming the\n            # sender so the addressed user can spot the reply. Visual only —\n            # DingTalk's markdown robot messages do not push real @ notifications.\n            sender_name = msg.metadata.get(\"sender_name\") if msg.metadata else None\n            safe_sender_name = (\n                _escape_markdown_sender_name(sender_name)\n                if isinstance(sender_name, str)\n                else \"\"\n            )\n            if msg.chat_id.startswith(\"group:\") and safe_sender_name:\n                content = f\"# @{safe_sender_name}\\n\\n{content}\"\n            if not await self._send_markdown_text(token, msg.chat_id, content):\n                raise RuntimeError(\"DingTalk text message was not delivered\")\n\n        for media_ref in msg.media or []:\n            ok = await self._send_media_ref(token, msg.chat_id, media_ref)\n            if ok:\n                continue\n            self.logger.error(\"media send failed for {}\", media_ref)\n            # Send visible fallback so failures are observable by the user.\n            filename = self._guess_filename(media_ref, self._guess_upload_type(media_ref))\n            if not await self._send_markdown_text(\n                token,\n                msg.chat_id,\n                f\"[Attachment send failed: {filename}]\",\n            ):\n                raise RuntimeError(\"DingTalk attachment fallback was not delivered\")\n\n    async def _on_message(\n        self,\n        content: str,","sourceCodeStart":757,"sourceCodeEnd":793,"githubUrl":"https://github.com/HKUDS/nanobot/blob/42f37dc4c0e409eac7818a82d165c5f2757bc075/nanobot/channels/dingtalk/runtime.py#L757-L793","documentation":"Error \"DingTalk text message was not delivered\" thrown in HKUDS/nanobot.","triggerScenarios":"Thrown at nanobot/channels/dingtalk/runtime.py:775 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"}