HKUDS/nanobot · error · RuntimeError
DingTalk access token unavailable
Error message
DingTalk access token unavailable
What it means
Error "DingTalk access token unavailable" thrown in HKUDS/nanobot.
Source
Thrown at nanobot/channels/dingtalk/runtime.py:759
"sampleImageMsg",
{"photoURL": media_id},
)
if ok:
return True
self.logger.warning("image media_id send failed, falling back to file: {}", media_ref)
return await self._send_batch_message(
token,
chat_id,
"sampleFile",
{"mediaId": media_id, "fileName": filename, "fileType": file_type},
)
async def send(self, msg: OutboundMessage) -> None:
"""Send a message through DingTalk."""
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 []:View on GitHub (pinned to 42f37dc4c0)
When it happens
Trigger: Thrown at nanobot/channels/dingtalk/runtime.py:759 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/046f5b07253cc2dc.
Report an issue: GitHub.