#10074·AstrBot

[Bug] AstrBot 核心 v4.28.0 与所用模型在"函数调用参数格式"上不兼容。

Author: Sxd55Created Sep 14, 2026Updated Sep 14, 2026
Labelsbug

问题描述

让bot查询知识库,bot查不了,一直说没权限。 我用的DeepSeek-V4-Flash-Vision-Exp

AstrBot 核心 v4.28.0 与所用模型在"函数调用参数格式"上不兼容。

原因链(日志里的关键证据):

模型把工具参数多包了一层:{'arguments': {'command': ..., 'yield_time_ms': ...}},正确格式应该是 {'command': ..., 'yield_time_ms': ...}。 AstrBot v4.28.0 核心没有剥掉外层 arguments,直接 handler(context, **tool_args) 传给了内置的 astrbot_execute_shell,而它的签名是 call(command, yield_time_ms=10000, timeout=None, env=None),不接受 arguments → TypeError(astr_agent_tool_exec.py:757)。 报错后 runner 继续把同样的坏参数喂回模型,模型越改越乱(后来变成 {'arguments': {'arguments': {...}}}),连续重试 7 次全部失败,白烧 token。whythemistake 插件的两次分析方向对但没指出是核心/模型格式问题。

如何复现?

让bot查询知识库 我用的DeepSeek-V4-Flash-Vision-Exp

AstrBot 版本

v4.28.0

操作系统

Windows

部署方式

docker

使用的消息平台适配器

onebot v11

错误日志

这是astrbot日志,帮我看看,出了什么问题
[2026-09-14 09:16:10.844] [Core]
[WARN]
[v4.28.0] [runners.tool_loop_agent_runner:1335]: Traceback (most recent call last):
  File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 757, in call_local_llm_tool
    ready_to_call = handler(context, *args, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: LocalExecuteShellTool.call() got an unexpected keyword argument 'arguments'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 1217, 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 1568, in _iter_tool_executor_results
    yield next_result_task.result()
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 1538, in _next_executor_result
    return await anext(executor)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 186, in execute
    async for r in cls._execute_local(tool, run_context, **tool_args):
  File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 683, 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 791, in call_local_llm_tool
    raise Exception(
Exception: Tool handler parameter mismatch, please check the handler definition. Handler parameters: command: str, yield_time_ms: int = 10000, timeout: int | None = None, env: dict[str, typing.Any] | None = None
[2026-09-14 09:16:10.845] [Core]
[INFO]
[runners.tool_loop_agent_runner:1360]: Tool `astrbot_execute_shell` Result: error: Tool handler parameter mismatch, please check the handler definition. Handler parameters: command: str, yield_time_ms: int = 10000, timeout: int | None = None, env: dict[str, typing.Any] | None = None
[2026-09-14 09:16:13.886] [astrbot_plugin_whythemistake]
[INFO]
[astrbot_plugin_whythemistake.main:104]: [WhyTheMistake] 错误分析: **原因**:模型调用工具时传入"arguments"参数,与工具定义不匹配。
**方案**:更新AstrBot至最新版,或修正工具参数定义。
[2026-09-14 09:16:25.662] [Core]
[INFO]
[runners.tool_loop_agent_runner:1107]: Agent 使用工具: ['astrbot_execute_shell']
[2026-09-14 09:16:25.663] [Core]
[INFO]
[runners.tool_loop_agent_runner:1163]: 使用工具:astrbot_execute_shell,参数:{'arguments': {'command': 'find /AstrBot/data/knowledge_base -type f 2>/dev/null | head -30', 'yield_time_ms': 10000}}
[2026-09-14 09:16:25.669] [Core]
[WARN]
[v4.28.0] [runners.tool_loop_agent_runner:1335]: Traceback (most recent call last):
  File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 757, in call_local_llm_tool
    ready_to_call = handler(context, *args, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: LocalExecuteShellTool.call() got an unexpected keyword argument 'arguments'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 1217, 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 1568, in _iter_tool_executor_results
    yield next_result_task.result()
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 1538, in _next_executor_result
    return await anext(executor)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 186, in execute
    async for r in cls._execute_local(tool, run_context, **tool_args):
  File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 683, 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 791, in call_local_llm_tool
    raise Exception(
Exception: Tool handler parameter mismatch, please check the handler definition. Handler parameters: command: str, yield_time_ms: int = 10000, timeout: int | None = None, env: dict[str, typing.Any] | None = None
[2026-09-14 09:16:25.670] [Core]
[INFO]
[runners.tool_loop_agent_runner:1360]: Tool `astrbot_execute_shell` Result: error: Tool handler parameter mismatch, please check the handler definition. Handler parameters: command: str, yield_time_ms: int = 10000, timeout: int | None = None, env: dict[str, typing.Any] | None = None
[2026-09-14 09:16:32.326] [astrbot_plugin_whythemistake]
[INFO]
[astrbot_plugin_whythemistake.main:104]: [WhyTheMistake] 错误分析: **问题原因**:Shell工具call()方法签名与核心不匹配,不接受arguments参数。

**解决方案**:升级AstrBot或对应插件,使call()方法兼容新签名。
[2026-09-14 09:16:34.438] [Core]
[INFO]
[runners.tool_loop_agent_runner:1107]: Agent 使用工具: ['astrbot_execute_shell']
[2026-09-14 09:16:34.438] [Core]
[INFO]
[runners.tool_loop_agent_runner:1163]: 使用工具:astrbot_execute_shell,参数:{'arguments': {'command': 'find /AstrBot/data/knowledge_base -type f 2>/dev/null | head -30', 'yield_time_ms': 10000}}
[2026-09-14 09:16:34.444] [Core]
[WARN]
[v4.28.0] [runners.tool_loop_agent_runner:1335]: Traceback (most recent call last):
  File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 757, in call_local_llm_tool
    ready_to_call = handler(context, *args, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: LocalExecuteShellTool.call() got an unexpected keyword argument 'arguments'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 1217, 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 1568, in _iter_tool_executor_results
    yield next_result_task.result()
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 1538, in _next_executor_result
    return await anext(executor)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 186, in execute
    async for r in cls._execute_local(tool, run_context, **tool_args):
  File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 683, 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 791, in call_local_llm_tool
    raise Exception(
Exception: Tool handler parameter mismatch, please check the handler definition. Handler parameters: command: str, yield_time_ms: int = 10000, timeout: int | None = None, env: dict[str, typing.Any] | None = None
[2026-09-14 09:16:34.444] [Core]
[INFO]
[runners.tool_loop_agent_runner:1360]: Tool `astrbot_execute_shell` Result: error: Tool handler parameter mismatch, please check the handler definition. Handler parameters: command: str, yield_time_ms: int = 10000, timeout: int | None = None, env: dict[str, typing.Any] | None = None

[SYSTEM NOTICE] By the way, you have executed the same tool `astrbot_execute_shell` with the same arguments 3 times consecutively. Double-check whether another tool, different arguments, or a summary would move the task forward better.
[2026-09-14 09:16:41.296] [Core]
[INFO]
[runners.tool_loop_agent_runner:1107]: Agent 使用工具: ['astrbot_execute_shell']
[2026-09-14 09:16:41.296] [Core]
[INFO]
[runners.tool_loop_agent_runner:1163]: 使用工具:astrbot_execute_shell,参数:{'arguments': {'command': 'find /AstrBot/data/knowledge_base -type f 2>/dev/null | head -30', 'yield_time_ms': 10000}}
[2026-09-14 09:16:41.302] [Core]
[WARN]
[v4.28.0] [runners.tool_loop_agent_runner:1335]: Traceback (most recent call last):
  File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 757, in call_local_llm_tool
    ready_to_call = handler(context, *args, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: LocalExecuteShellTool.call() got an unexpected keyword argument 'arguments'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 1217, 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 1568, in _iter_tool_executor_results
    yield next_result_task.result()
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 1538, in _next_executor_result
    return await anext(executor)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 186, in execute
    async for r in cls._execute_local(tool, run_context, **tool_args):
  File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 683, 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 791, in call_local_llm_tool
    raise Exception(
Exception: Tool handler parameter mismatch, please check the handler definition. Handler parameters: command: str, yield_time_ms: int = 10000, timeout: int | None = None, env: dict[str, typing.Any] | None = None
[2026-09-14 09:16:41.303] [Core]
[INFO]
[runners.tool_loop_agent_runner:1360]: Tool `astrbot_execute_shell` Result: error: Tool handler parameter mismatch, please check the handler definition. Handler parameters: command: str, yield_time_ms: int = 10000, timeout: int | None = None, env: dict[str, typing.Any] | None = None

[SYSTEM NOTICE] Important: you have executed the same tool `astrbot_execute_shell` with the same arguments 4 times consecutively. Unless this repetition is clearly necessary, stop repeating the same action and either switch tools, refine parameters, or summarize what is still missing.
[2026-09-14 09:16:50.553] [Core]
[INFO]
[runners.tool_loop_agent_runner:1107]: Agent 使用工具: ['astrbot_execute_shell']
[2026-09-14 09:16:50.554] [Core]
[INFO]
[runners.tool_loop_agent_runner:1163]: 使用工具:astrbot_execute_shell,参数:{'arguments': {'arguments': {'command': 'find /AstrBot/data/knowledge_base -type f 2>/dev/null | head -30', 'yield_time_ms': 10000}}}
[2026-09-14 09:16:50.559] [Core]
[WARN]
[v4.28.0] [runners.tool_loop_agent_runner:1335]: Traceback (most recent call last):
  File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 757, in call_local_llm_tool
    ready_to_call = handler(context, *args, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: LocalExecuteShellTool.call() got an unexpected keyword argument 'arguments'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 1217, 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 1568, in _iter_tool_executor_results
    yield next_result_task.result()
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 1538, in _next_executor_result
    return await anext(executor)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 186, in execute
    async for r in cls._execute_local(tool, run_context, **tool_args):
  File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 683, 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 791, in call_local_llm_tool
    raise Exception(
Exception: Tool handler parameter mismatch, please check the handler definition. Handler parameters: command: str, yield_time_ms: int = 10000, timeout: int | None = None, env: dict[str, typing.Any] | None = None
[2026-09-14 09:16:50.560] [Core]
[INFO]
[runners.tool_loop_agent_runner:1360]: Tool `astrbot_execute_shell` Result: error: Tool handler parameter mismatch, please check the handler definition. Handler parameters: command: str, yield_time_ms: int = 10000, timeout: int | None = None, env: dict[str, typing.Any] | None = None
[2026-09-14 09:16:52.482] [astrbot_plugin_whythemistake]
[INFO]
[astrbot_plugin_whythemistake.main:104]: [WhyTheMistake] 错误分析: 【问题原因】插件工具参数定义与函数签名不匹配,无法接收 arguments 参数。

【解决方案】更新插件,或修正工具参数名使其与函数签名一致。
[2026-09-14 09:17:02.236] [Core]
[INFO]
[runners.tool_loop_agent_runner:1107]: Agent 使用工具: ['astrbot_execute_shell']
[2026-09-14 09:17:02.237] [Core]
[INFO]
[runners.tool_loop_agent_runner:1163]: 使用工具:astrbot_execute_shell,参数:{'arguments': {'arguments': {'command': 'find /AstrBot/data/knowledge_base -type f 2>/dev/null | head -30', 'yield_time_ms': 10000}}}
[2026-09-14 09:17:02.240] [Core]
[WARN]
[v4.28.0] [runners.tool_loop_agent_runner:1335]: Traceback (most recent call last):
  File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 757, in call_local_llm_tool
    ready_to_call = handler(context, *args, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: LocalExecuteShellTool.call() got an unexpected keyword argument 'arguments'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 1217, 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 1568, in _iter_tool_executor_results
    yield next_result_task.result()
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 1538, in _next_executor_result
    return await anext(executor)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 186, in execute
    async for r in cls._execute_local(tool, run_context, **tool_args):
  File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 683, 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 791, in call_local_llm_tool
    raise Exception(
Exception: Tool handler parameter mismatch, please check the handler definition. Handler parameters: command: str, yield_time_ms: int = 10000, timeout: int | None = None, env: dict[str, typing.Any] | None = None
[2026-09-14 09:17:02.241] [Core]
[INFO]
[runners.tool_loop_agent_runner:1360]: Tool `astrbot_execute_shell` Result: error: Tool handler parameter mismatch, please check the handler definition. Handler parameters: command: str, yield_time_ms: int = 10000, timeout: int | None = None, env: dict[str, typing.Any] | None = None
[2026-09-14 09:17:12.967] [Core]
[INFO]
[runners.tool_loop_agent_runner:1107]: Agent 使用工具: ['astrbot_execute_shell']
[2026-09-14 09:17:12.968] [Core]
[INFO]
[runners.tool_loop_agent_runner:1163]: 使用工具:astrbot_execute_shell,参数:{'arguments': {'arguments': {'command': 'echo SUCCESS-WITHOUT-ARGS-WRAPPER', 'yield_time_ms': 10000}}}
[2026-09-14 09:17:12.975] [Core]
[WARN]
[v4.28.0] [runners.tool_loop_agent_runner:1335]: Traceback (most recent call last):
  File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 757, in call_local_llm_tool
    ready_to_call = handler(context, *args, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: LocalExecuteShellTool.call() got an unexpected keyword argument 'arguments'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 1217, 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 1568, in _iter_tool_executor_results
    yield next_result_task.result()
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 1538, in _next_executor_result
    return await anext(executor)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 186, in execute
    async for r in cls._execute_local(tool, run_context, **tool_args):
  File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 683, 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 791, in call_local_llm_tool
    raise Exception(
Exception: Tool handler parameter mismatch, please check the handler definition. Handler parameters: command: str, yield_time_ms: int = 10000, timeout: int | None = None, env: dict[str, typing.Any] | None = None
[2026-09-14 09:17:12.976] [Core]
[INFO]
[runners.tool_loop_agent_runner:1360]: Tool `astrbot_execute_shell` Result: error: Tool handler parameter mismatch, please check the handler definition. Handler parameters: command: str, yield_time_ms: int = 10000, timeout: int | None = None, env: dict[str, typing.Any] | None = None
[2026-09-14 09:17:19.264] [astrbot_plugin_whythemistake]
[INFO]
[astrbot_plugin_whythemistake.main:104]: [WhyTheMistake] 错误分析: 【问题原因】工具call()函数签名与声明参数不符,收到未定义的arguments参数。

【解决方案】修正插件工具函数定义使其匹配,或更新插件/AstrBot版本。
[2026-09-14 09:17:21.972] [astrbot_plugin_whythemistake]
[INFO]
[astrbot_plugin_whythemistake.main:104]: [WhyTheMistake] 错误分析: **原因**:工具函数签名与schema不符,LLM传入未定义的'arguments'参数报错。

**方案**:更新或修复插件,使工具参数与定义一致。

辅助信息

No response

检查清单

  • 我已在 Issue 列表中搜索过相关问题仍无法解决,或该问题从未被报告过。
  • 我已尝试过禁用所有插件,排除了可能是因插件导致的问题。
  • 我报告的问题与 AstrBot 本体相关,而非在报告某一插件的问题。
  • 我已阅读并同意本项目的贡献者行为准则
  • (可选)我愿意提交 PR 以帮助修复该问题。