Skip to content

[Bug]触发了定时任务后推送到QQ机器人报错 #6670

@Nyxlux-bot

Description

@Nyxlux-bot

What happened / 发生了什么

触发了定时任务后推送到QQ机器人报错,[2026-03-20 14:00:19.364] [Core] [INFO] [runners.tool_loop_agent_runner:881]: Tool send_message_to_user Result: error: 请求参数msg_id无效或越权,偶尔会这样,不是所有定时任务这样。

Reproduce / 如何复现?

让AI帮我创建了定时任务,推送每日系统状态。如
获取系统CPU、内存、磁盘和运行时间。生成纯文本格式(禁用Markdown),用简短幽默的语气锐评系统状态。字数控制在300字以内,避免QQ风控。推送给老板当前聊天。

AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器

AstrBot版本:v4.20.1
部署方式:uv
使用的提供商:第三方中转
使用的消息平台适配器:QQ机器人(websockets)

OS

Linux

Logs / 报错日志

[2026-03-20 11:50:41.305] [Plug] [ERRO] [v4.20.1] [astrbot_plugin_meme_manager.main:1046]: 发送表情图片失败: 请求参数msg_id无效或越权
[2026-03-20 11:50:41.310] [Plug] [ERRO] [v4.20.1] [astrbot_plugin_meme_manager.main:1047]: Traceback (most recent call last):
File "/opt/Astrbot/data/plugins/astrbot_plugin_meme_manager/main.py", line 1042, in after_message_sent
await self.context.send_message(
File "/root/.local/share/uv/tools/astrbot/lib/python3.12/site-packages/astrbot/core/star/context.py", line 456, in send_message
await platform.send_by_session(session, message_chain)
File "/root/.local/share/uv/tools/astrbot/lib/python3.12/site-packages/astrbot/core/platform/sources/qqofficial/qqofficial_platform_adapter.py", line 144, in send_by_session
await self._send_by_session_common(session, message_chain)
File "/root/.local/share/uv/tools/astrbot/lib/python3.12/site-packages/astrbot/core/platform/sources/qqofficial/qqofficial_platform_adapter.py", line 287, in _send_by_session_common
ret = await QQOfficialMessageEvent.post_c2c_message(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/share/uv/tools/astrbot/lib/python3.12/site-packages/astrbot/core/platform/sources/qqofficial/qqofficial_message_event.py", line 566, in post_c2c_message
result = await self.bot.api._http.request(route, json=payload)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/share/uv/tools/astrbot/lib/python3.12/site-packages/botpy/http.py", line 190, in request
return await _handle_response(response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/share/uv/tools/astrbot/lib/python3.12/site-packages/botpy/http.py", line 85, in _handle_response
raise ServerError(message) from None # adding from None to prevent chain exception being raised
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
botpy.errors.ServerError: 请求参数msg_id无效或越权
[2026-03-20 14:00:11.773] [Core] [INFO] [runners.tool_loop_agent_runner:657]: Agent 使用工具: ['astrbot_execute_shell']
[2026-03-20 14:00:11.775] [Core] [INFO] [runners.tool_loop_agent_runner:703]: 使用工具:astrbot_execute_shell,参数:{'command': 'uptime && free -h && df -h / | tail -1'}
[2026-03-20 14:00:11.803] [Core] [INFO] [runners.tool_loop_agent_runner:881]: Tool astrbot_execute_shell Result: {"stdout": " 14:00:11 up 87 days, 17:38, 1 user, load average: 0.00, 0.00, 0.00\n total used free shared buff/cache available\nMem: 3.8Gi 1.3Gi 339Mi 97Mi 2.6Gi 2.5Gi\nSwap: 2.0Gi 39Mi 2.0Gi\n/dev/vda2 62G 18G 42G 29% /\n", "stderr": "", "exit_code": 0}
[2026-03-20 14:00:18.564] [Core] [INFO] [runners.tool_loop_agent_runner:657]: Agent 使用工具: ['send_message_to_user']
[2026-03-20 14:00:18.565] [Core] [INFO] [runners.tool_loop_agent_runner:703]: 使用工具:send_message_to_user,参数:{'messages': [{'type': 'plain', 'text': '老板,系统体检结果到了。\n运行87天,稳得像老油条。负载0.00,CPU闲得发慌;内存3.8G用了1.3G,还挺克制;磁盘62G用了18G,占29%,离吃满还早。\n结论:机器状态健康,今天没闹脾气。真正该休息的不是它,是总爱熬的某位老板。', 'path': '', 'url': '', 'mention_user_id': ''}]}
[2026-03-20 14:00:19.356] [Core] [WARN] [v4.20.1] [runners.tool_loop_agent_runner:858]: Traceback (most recent call last):
File "/root/.local/share/uv/tools/astrbot/lib/python3.12/site-packages/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 757, in _handle_function_tools
async for resp in executor: # type: ignore
File "/root/.local/share/uv/tools/astrbot/lib/python3.12/site-packages/astrbot/core/astr_agent_tool_exec.py", line 175, in execute
async for r in cls._execute_local(tool, run_context, **tool_args):
File "/root/.local/share/uv/tools/astrbot/lib/python3.12/site-packages/astrbot/core/astr_agent_tool_exec.py", line 596, in _execute_local
resp = await asyncio.wait_for(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
return await fut
^^^^^^^^^
File "/root/.local/share/uv/tools/astrbot/lib/python3.12/site-packages/astrbot/core/astr_agent_tool_exec.py", line 737, in call_local_llm_tool
ret = await ready_to_call
^^^^^^^^^^^^^^^^^^^
File "/root/.local/share/uv/tools/astrbot/lib/python3.12/site-packages/astrbot/core/astr_main_agent_resources.py", line 385, in call
await context.context.context.send_message(
File "/root/.local/share/uv/tools/astrbot/lib/python3.12/site-packages/astrbot/core/star/context.py", line 456, in send_message
await platform.send_by_session(session, message_chain)
File "/root/.local/share/uv/tools/astrbot/lib/python3.12/site-packages/astrbot/core/platform/sources/qqofficial/qqofficial_platform_adapter.py", line 144, in send_by_session
await self._send_by_session_common(session, message_chain)
File "/root/.local/share/uv/tools/astrbot/lib/python3.12/site-packages/astrbot/core/platform/sources/qqofficial/qqofficial_platform_adapter.py", line 287, in _send_by_session_common
ret = await QQOfficialMessageEvent.post_c2c_message(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/share/uv/tools/astrbot/lib/python3.12/site-packages/astrbot/core/platform/sources/qqofficial/qqofficial_message_event.py", line 566, in post_c2c_message
result = await self.bot.api._http.request(route, json=payload)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/share/uv/tools/astrbot/lib/python3.12/site-packages/botpy/http.py", line 190, in request
return await _handle_response(response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/share/uv/tools/astrbot/lib/python3.12/site-packages/botpy/http.py", line 85, in _handle_response
raise ServerError(message) from None # adding from None to prevent chain exception being raised
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
botpy.errors.ServerError: 请求参数msg_id无效或越权
[2026-03-20 14:00:19.364] [Core] [INFO] [runners.tool_loop_agent_runner:881]: Tool send_message_to_user Result: error: 请求参数msg_id无效或越权

Are you willing to submit a PR? / 你愿意提交 PR 吗?

  • Yes!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:platformThe bug / feature is about IM platform adapter, such as QQ, Lark, Telegram, WebChat and so on.bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions