HKUDS/nanobot · error · RuntimeError

DingTalk text message was not delivered

Error message

DingTalk text message was not delivered

What it means

Error "DingTalk text message was not delivered" thrown in HKUDS/nanobot.

Source

Thrown at nanobot/channels/dingtalk/runtime.py:775

        token = await self._get_access_token()
        if not token:
            raise RuntimeError("DingTalk access token unavailable")

        content = msg.content.strip() if msg.content else ""
        if content:
            # In group chats, prefix the reply with a markdown header naming the
            # sender so the addressed user can spot the reply. Visual only —
            # DingTalk's markdown robot messages do not push real @ notifications.
            sender_name = msg.metadata.get("sender_name") if msg.metadata else None
            safe_sender_name = (
                _escape_markdown_sender_name(sender_name)
                if isinstance(sender_name, str)
                else ""
            )
            if msg.chat_id.startswith("group:") and safe_sender_name:
                content = f"# @{safe_sender_name}\n\n{content}"
            if not await self._send_markdown_text(token, msg.chat_id, content):
                raise RuntimeError("DingTalk text message was not delivered")

        for media_ref in msg.media or []:
            ok = await self._send_media_ref(token, msg.chat_id, media_ref)
            if ok:
                continue
            self.logger.error("media send failed for {}", media_ref)
            # Send visible fallback so failures are observable by the user.
            filename = self._guess_filename(media_ref, self._guess_upload_type(media_ref))
            if not await self._send_markdown_text(
                token,
                msg.chat_id,
                f"[Attachment send failed: {filename}]",
            ):
                raise RuntimeError("DingTalk attachment fallback was not delivered")

    async def _on_message(
        self,
        content: str,

View on GitHub (pinned to 42f37dc4c0)

When it happens

Trigger: Thrown at nanobot/channels/dingtalk/runtime.py:775 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/80782e5636babcc7. Report an issue: GitHub.