What happened / 发生了什么
使用deepseekv4 flash报400错误
Reproduce / 如何复现?
昨日正常使用,今早出现问题,我没有做任何改动。
AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器
mac系统,astrbot4.25.2,docker部署napcat
OS
macOS
Logs / 报错日志
[2026-06-05 07:43:05.870] [Core]
[WARN]
[v4.25.2] [runners.tool_loop_agent_runner:557]: Chat Model openai/deepseek-v4-flash request error: Error code: 400 - {'error': {'message': "Error from provider (DeepSeek): Messages with role 'tool' must be a response to a preceding message with 'tool_calls'", 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_request_error'}}
Traceback (most recent call last):
File "/Applications/AstrBot.app/Contents/Resources/backend/app/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 512, in _iter_llm_responses_with_fallback
async for attempt in retrying:
File "/Applications/AstrBot.app/Contents/Resources/backend/python/lib/python3.12/site-packages/tenacity/asyncio/init.py", line 170, in anext
do = await self.iter(retry_state=self._retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Applications/AstrBot.app/Contents/Resources/backend/python/lib/python3.12/site-packages/tenacity/asyncio/init.py", line 157, in iter
result = await action(retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Applications/AstrBot.app/Contents/Resources/backend/python/lib/python3.12/site-packages/tenacity/_utils.py", line 111, in inner
return call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Applications/AstrBot.app/Contents/Resources/backend/python/lib/python3.12/site-packages/tenacity/init.py", line 393, in
self._add_action_func(lambda rs: rs.outcome.result())
^^^^^^^^^^^^^^^^^^^
File "/Applications/AstrBot.app/Contents/Resources/backend/python/lib/python3.12/concurrent/futures/_base.py", line 449, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/Applications/AstrBot.app/Contents/Resources/backend/python/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/Applications/AstrBot.app/Contents/Resources/backend/app/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 516, in _iter_llm_responses_with_fallback
async for resp in self._iter_llm_responses(
File "/Applications/AstrBot.app/Contents/Resources/backend/app/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 479, in _iter_llm_responses
yield await self.provider.text_chat(**payload)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Applications/AstrBot.app/Contents/Resources/backend/app/astrbot/core/provider/sources/openai_source.py", line 1286, in text_chat
) = await self._handle_api_error(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Applications/AstrBot.app/Contents/Resources/backend/app/astrbot/core/provider/sources/openai_source.py", line 1232, in _handle_api_error
raise e
File "/Applications/AstrBot.app/Contents/Resources/backend/app/astrbot/core/provider/sources/openai_source.py", line 1274, in text_chat
llm_response = await self._query(payloads, func_tool)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Applications/AstrBot.app/Contents/Resources/backend/app/astrbot/core/provider/sources/openai_source.py", line 639, in _query
completion = await self.client.chat.completions.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Applications/AstrBot.app/Contents/Resources/backend/python/lib/python3.12/site-packages/openai/resources/chat/completions/completions.py", line 2739, in create
return await self._post(
^^^^^^^^^^^^^^^^^
File "/Applications/AstrBot.app/Contents/Resources/backend/python/lib/python3.12/site-packages/openai/_base_client.py", line 1931, in post
return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Applications/AstrBot.app/Contents/Resources/backend/python/lib/python3.12/site-packages/openai/_base_client.py", line 1716, in request
raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {'error': {'message': "Error from provider (DeepSeek): Messages with role 'tool' must be a response to a preceding message with 'tool_calls'", 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_request_error'}}
[2026-06-05 07:43:05.898] [Core]
[WARN]
[v4.25.2] [runners.tool_loop_agent_runner:494]: Switched from openai/deepseek-v4-flash to fallback chat provider: openai/mimo-v2.5
Are you willing to submit a PR? / 你愿意提交 PR 吗?
Code of Conduct
What happened / 发生了什么
使用deepseekv4 flash报400错误
Reproduce / 如何复现?
昨日正常使用,今早出现问题,我没有做任何改动。
AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器
mac系统,astrbot4.25.2,docker部署napcat
OS
macOS
Logs / 报错日志
[2026-06-05 07:43:05.870] [Core]
[WARN]
[v4.25.2] [runners.tool_loop_agent_runner:557]: Chat Model openai/deepseek-v4-flash request error: Error code: 400 - {'error': {'message': "Error from provider (DeepSeek): Messages with role 'tool' must be a response to a preceding message with 'tool_calls'", 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_request_error'}}
Traceback (most recent call last):
File "/Applications/AstrBot.app/Contents/Resources/backend/app/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 512, in _iter_llm_responses_with_fallback
async for attempt in retrying:
File "/Applications/AstrBot.app/Contents/Resources/backend/python/lib/python3.12/site-packages/tenacity/asyncio/init.py", line 170, in anext
do = await self.iter(retry_state=self._retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Applications/AstrBot.app/Contents/Resources/backend/python/lib/python3.12/site-packages/tenacity/asyncio/init.py", line 157, in iter
result = await action(retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Applications/AstrBot.app/Contents/Resources/backend/python/lib/python3.12/site-packages/tenacity/_utils.py", line 111, in inner
return call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Applications/AstrBot.app/Contents/Resources/backend/python/lib/python3.12/site-packages/tenacity/init.py", line 393, in
self._add_action_func(lambda rs: rs.outcome.result())
^^^^^^^^^^^^^^^^^^^
File "/Applications/AstrBot.app/Contents/Resources/backend/python/lib/python3.12/concurrent/futures/_base.py", line 449, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/Applications/AstrBot.app/Contents/Resources/backend/python/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/Applications/AstrBot.app/Contents/Resources/backend/app/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 516, in _iter_llm_responses_with_fallback
async for resp in self._iter_llm_responses(
File "/Applications/AstrBot.app/Contents/Resources/backend/app/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 479, in _iter_llm_responses
yield await self.provider.text_chat(**payload)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Applications/AstrBot.app/Contents/Resources/backend/app/astrbot/core/provider/sources/openai_source.py", line 1286, in text_chat
) = await self._handle_api_error(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Applications/AstrBot.app/Contents/Resources/backend/app/astrbot/core/provider/sources/openai_source.py", line 1232, in _handle_api_error
raise e
File "/Applications/AstrBot.app/Contents/Resources/backend/app/astrbot/core/provider/sources/openai_source.py", line 1274, in text_chat
llm_response = await self._query(payloads, func_tool)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Applications/AstrBot.app/Contents/Resources/backend/app/astrbot/core/provider/sources/openai_source.py", line 639, in _query
completion = await self.client.chat.completions.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Applications/AstrBot.app/Contents/Resources/backend/python/lib/python3.12/site-packages/openai/resources/chat/completions/completions.py", line 2739, in create
return await self._post(
^^^^^^^^^^^^^^^^^
File "/Applications/AstrBot.app/Contents/Resources/backend/python/lib/python3.12/site-packages/openai/_base_client.py", line 1931, in post
return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Applications/AstrBot.app/Contents/Resources/backend/python/lib/python3.12/site-packages/openai/_base_client.py", line 1716, in request
raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {'error': {'message': "Error from provider (DeepSeek): Messages with role 'tool' must be a response to a preceding message with 'tool_calls'", 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_request_error'}}
[2026-06-05 07:43:05.898] [Core]
[WARN]
[v4.25.2] [runners.tool_loop_agent_runner:494]: Switched from openai/deepseek-v4-flash to fallback chat provider: openai/mimo-v2.5
Are you willing to submit a PR? / 你愿意提交 PR 吗?
Code of Conduct