Skip to content

[Bug]当给bot发送“查一下昨天发生的大事”之类的网页查询命令,会无限轮回报错。 #7499

@hxy310

Description

@hxy310

What happened / 发生了什么

当给bot发送“查一下昨天发生的大事”之类的网页查询命令,而且会无限轮回报错,要么重启AstrBot要么在当前会话发送下一条指令才会终止。

Reproduce / 如何复现?

直接给bot发送 “查一下昨天发生的大事”

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

v4.23.0,Desktop 部署,openai,webchat

OS

Linux

Logs / 报错日志

[2026-04-13 03:26:04.511] [Core] [INFO] [core.event_bus:61]: [聊天机器人] [webchat(webchat)] admin/admin: 查一下 昨天发生了什么大事
[2026-04-13 03:26:04.522] [Core] [INFO] [respond.stage:183]: Prepare to send - admin/admin:
[2026-04-13 03:26:04.522] [Core] [INFO] [respond.stage:199]: 应用流式输出(webchat)
[2026-04-13 03:26:12.642] [Core] [INFO] [runners.tool_loop_agent_runner:883]: Agent 使用工具: ['web_search_tavily']
[2026-04-13 03:26:12.642] [Core] [INFO] [runners.tool_loop_agent_runner:930]: 使用工具:web_search_tavily,参数:{}
[2026-04-13 03:26:12.644] [Core] [WARN] [v4.23.0] [runners.tool_loop_agent_runner:1102]: Traceback (most recent call last):
File "/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 984, in _handle_function_tools
async for resp in self._iter_tool_executor_results(executor): # type: ignore
File "/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 1332, in _iter_tool_executor_results
yield next_result_task.result()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 180, in execute
async for r in cls._execute_local(tool, run_context, **tool_args):
File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 638, in _execute_local
resp = await asyncio.wait_for(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
return await fut
^^^^^^^^^
File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 779, in call_local_llm_tool
ret = await ready_to_call
^^^^^^^^^^^^^^^^^^^
File "/AstrBot/astrbot/core/tools/web_search_tools.py", line 355, in call
"query": kwargs["query"],
~~~~~~^^^^^^^^^
KeyError: 'query'
[2026-04-13 03:26:12.644] [Core] [INFO] [runners.tool_loop_agent_runner:1128]: Tool web_search_tavily Result: error: 'query'
[2026-04-13 03:26:20.198] [Core] [INFO] [runners.tool_loop_agent_runner:883]: Agent 使用工具: ['web_search_tavily']
[2026-04-13 03:26:20.199] [Core] [INFO] [runners.tool_loop_agent_runner:930]: 使用工具:web_search_tavily,参数:{}
[2026-04-13 03:26:20.201] [Core] [WARN] [v4.23.0] [runners.tool_loop_agent_runner:1102]: Traceback (most recent call last):
File "/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 984, in _handle_function_tools
async for resp in self._iter_tool_executor_results(executor): # type: ignore
File "/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 1332, in _iter_tool_executor_results
yield next_result_task.result()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 180, in execute
async for r in cls._execute_local(tool, run_context, **tool_args):
File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 638, in _execute_local
resp = await asyncio.wait_for(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
return await fut
^^^^^^^^^
File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 779, in call_local_llm_tool
ret = await ready_to_call
^^^^^^^^^^^^^^^^^^^
File "/AstrBot/astrbot/core/tools/web_search_tools.py", line 355, in call
"query": kwargs["query"],
~~~~~~^^^^^^^^^
KeyError: 'query'
[2026-04-13 03:26:20.202] [Core] [INFO] [runners.tool_loop_agent_runner:1128]: Tool web_search_tavily Result: error: 'query'
[2026-04-13 03:26:26.767] [Core] [INFO] [runners.tool_loop_agent_runner:883]: Agent 使用工具: ['web_search_tavily']
[2026-04-13 03:26:26.768] [Core] [INFO] [runners.tool_loop_agent_runner:930]: 使用工具:web_search_tavily,参数:{}
[2026-04-13 03:26:26.770] [Core] [WARN] [v4.23.0] [runners.tool_loop_agent_runner:1102]: Traceback (most recent call last):
File "/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 984, in _handle_function_tools
async for resp in self._iter_tool_executor_results(executor): # type: ignore
File "/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 1332, in _iter_tool_executor_results
yield next_result_task.result()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 180, in execute
async for r in cls._execute_local(tool, run_context, **tool_args):
File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 638, in _execute_local
resp = await asyncio.wait_for(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
return await fut
^^^^^^^^^
File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 779, in call_local_llm_tool
ret = await ready_to_call
^^^^^^^^^^^^^^^^^^^
File "/AstrBot/astrbot/core/tools/web_search_tools.py", line 355, in call
"query": kwargs["query"],
~~~~~~^^^^^^^^^
KeyError: 'query'
[2026-04-13 03:26:26.770] [Core] [INFO] [runners.tool_loop_agent_runner:1128]: Tool web_search_tavily Result: error: 'query'

[SYSTEM NOTICE] By the way, you have executed the same tool web_search_tavily 3 times consecutively. Double-check whether another tool, different arguments, or a summary would move the task forward better.

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

  • Yes!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreThe bug / feature is about astrbot's core, backendbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions