-
-
Notifications
You must be signed in to change notification settings - Fork 2k
[Bug] gemini开启高级配置中的“启用原生搜索功能”“启用URL上下文功能”等功能时,疑似构造了错误的请求参数,导致请求出错。 #7406
Copy link
Copy link
Open
Labels
area:providerThe bug / feature is about AI Provider, Models, LLM Agent, LLM Agent Runner.The bug / feature is about AI Provider, Models, LLM Agent, LLM Agent Runner.bugSomething isn't workingSomething isn't working
Description
What happened / 发生了什么
LLM响应错误:
All chat models failed: ClientError: 400 INVALID_ARGUMENT. {'error': {'code': 400, 'message': 'Function calling config is set without function_declarations.', 'status': 'INVALID_ARGUMENT'}}
Reproduce / 如何复现?
配置一个官网 https://generativelanguage.googleapis.com 的google_gemini/gemini-2.5-flash模型,启用启高级配置中的“启用原生搜索功能”“启用URL上下文功能”选项,保存后配置为默认模型进行对话。
AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器
AstrBot v4.22.3 使用linux源码部署,使用Google官方api,QQ平台
OS
Windows
Logs / 报错日志
[2026-04-07 14:54:36.114] [Core] [INFO] [core.event_bus:61]: [default] [astrbot(aiocqhttp)] 逸木/872778579: [At:2578272592] 你哪个初中的
[2026-04-07 14:54:36.115] [Core] [DBUG] [waking_check.stage:157]: enabled_plugins_name: ['*']
[2026-04-07 14:54:36.497] [Core] [DBUG] [method.star_request:44]: plugin -> session_controller - handle_session_control_agent
[2026-04-07 14:54:36.498] [Core] [DBUG] [method.star_request:44]: plugin -> session_controller - handle_empty_mention
[2026-04-07 14:54:36.498] [Core] [DBUG] [method.star_request:44]: plugin -> astrbot_plugin_wakepro - on_group_msg
[2026-04-07 14:54:36.498] [Plug] [DBUG] [astrbot_plugin_wakepro.main:261]: 已添加event到缓存:1
[2026-04-07 14:54:36.499] [Plug] [INFO] [astrbot_plugin_wakepro.main:267]: [wakepro] 群(71901396)at_or_cmd:你哪个初中的
[2026-04-07 14:54:36.499] [Plug] [DBUG] [astrbot_plugin_wakepro.sentiment:219]: [wakepro] ['哪个', '初中']
[2026-04-07 14:54:36.499] [Core] [DBUG] [method.star_request:44]: plugin -> astrbot - on_message
[2026-04-07 14:54:36.500] [Plug] [DBUG] [astrbot.long_term_memory:146]: ltm | astrbot:GroupMessage:71901396 | [逸木/14:54:36]: [At: 猫猫头] 你哪个初中的
[2026-04-07 14:54:36.504] [Core] [DBUG] [agent_sub_stages.internal:167]: ready to request llm provider
[2026-04-07 14:54:36.504] [Core] [DBUG] [agent_sub_stages.internal:190]: acquired session lock for llm request
[2026-04-07 14:54:36.795] [Core] [DBUG] [core.astr_main_agent_resources:463]: [知识库] 使用全局配置,知识库数量: 0
[2026-04-07 14:54:36.796] [Core] [DBUG] [pipeline.context_utils:95]: hook(OnLLMRequestEvent) -> astrbot - decorate_llm_req
[2026-04-07 14:54:36.796] [Core] [DBUG] [pipeline.context_utils:95]: hook(OnLLMRequestEvent) -> astrbot-web-searcher - edit_web_search_tools
[2026-04-07 14:54:36.796] [Core] [DBUG] [runners.base:64]: Agent state transition: AgentState.IDLE -> AgentState.RUNNING
[2026-04-07 14:54:36.797] [Core] [DBUG] [runners.tool_loop_agent_runner:379]: [BefCompact] RunCtx.messages -> [8] system,user,assistant,user,assistant,user,assistant,user
[2026-04-07 14:54:36.797] [Core] [DBUG] [runners.tool_loop_agent_runner:379]: [AftCompact] RunCtx.messages -> [8] system,user,assistant,user,assistant,user,assistant,user
[2026-04-07 14:54:36.798] [Core] [WARN] [v4.22.3] [sources.gemini_source:206]: 已启用原生工具,函数工具将被忽略
[2026-04-07 14:54:37.783] [Core] [WARN] [v4.22.3] [runners.tool_loop_agent_runner:350]: Chat Model google_gemini/gemini-2.5-flash request error: 400 INVALID_ARGUMENT. {'error': {'code': 400, 'message': 'Function calling config is set without function_declarations.', 'status': 'INVALID_ARGUMENT'}}
Traceback (most recent call last):
File "/home/qqbot/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 305, in _iter_llm_responses_with_fallback
async for attempt in retrying:
File "/home/qqbot/AstrBot/venv/lib/python3.10/site-packages/tenacity/asyncio/__init__.py", line 166, in __anext__
do = await self.iter(retry_state=self._retry_state)
File "/home/qqbot/AstrBot/venv/lib/python3.10/site-packages/tenacity/asyncio/__init__.py", line 153, in iter
result = await action(retry_state)
File "/home/qqbot/AstrBot/venv/lib/python3.10/site-packages/tenacity/_utils.py", line 99, in inner
return call(*args, **kwargs)
File "/home/qqbot/AstrBot/venv/lib/python3.10/site-packages/tenacity/__init__.py", line 400, in <lambda>
self._add_action_func(lambda rs: rs.outcome.result())
File "/home/qqbot/.pyenv/versions/3.10.12/lib/python3.10/concurrent/futures/_base.py", line 451, in result
return self.__get_result()
File "/home/qqbot/.pyenv/versions/3.10.12/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
raise self._exception
File "/home/qqbot/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 309, in _iter_llm_responses_with_fallback
async for resp in self._iter_llm_responses(
File "/home/qqbot/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 272, in _iter_llm_responses
yield await self.provider.text_chat(**payload)
File "/home/qqbot/AstrBot/astrbot/core/provider/sources/gemini_source.py", line 821, in text_chat
if await self._handle_api_error(e, keys):
File "/home/qqbot/AstrBot/astrbot/core/provider/sources/gemini_source.py", line 129, in _handle_api_error
raise e
File "/home/qqbot/AstrBot/astrbot/core/provider/sources/gemini_source.py", line 819, in text_chat
return await self._query(payloads, func_tool)
File "/home/qqbot/AstrBot/astrbot/core/provider/sources/gemini_source.py", line 587, in _query
result = await self.client.models.generate_content(
File "/home/qqbot/AstrBot/venv/lib/python3.10/site-packages/google/genai/models.py", line 7009, in generate_content
return await self._generate_content(
File "/home/qqbot/AstrBot/venv/lib/python3.10/site-packages/google/genai/models.py", line 5848, in _generate_content
response = await self._api_client.async_request(
File "/home/qqbot/AstrBot/venv/lib/python3.10/site-packages/google/genai/_api_client.py", line 1432, in async_request
result = await self._async_request(
File "/home/qqbot/AstrBot/venv/lib/python3.10/site-packages/google/genai/_api_client.py", line 1365, in _async_request
return await self._async_retry( # type: ignore[no-any-return]
File "/home/qqbot/AstrBot/venv/lib/python3.10/site-packages/tenacity/asyncio/__init__.py", line 111, in __call__
do = await self.iter(retry_state=retry_state)
File "/home/qqbot/AstrBot/venv/lib/python3.10/site-packages/tenacity/asyncio/__init__.py", line 153, in iter
result = await action(retry_state)
File "/home/qqbot/AstrBot/venv/lib/python3.10/site-packages/tenacity/_utils.py", line 99, in inner
return call(*args, **kwargs)
File "/home/qqbot/AstrBot/venv/lib/python3.10/site-packages/tenacity/__init__.py", line 420, in exc_check
raise retry_exc.reraise()
File "/home/qqbot/AstrBot/venv/lib/python3.10/site-packages/tenacity/__init__.py", line 187, in reraise
raise self.last_attempt.result()
File "/home/qqbot/.pyenv/versions/3.10.12/lib/python3.10/concurrent/futures/_base.py", line 451, in result
return self.__get_result()
File "/home/qqbot/.pyenv/versions/3.10.12/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
raise self._exception
File "/home/qqbot/AstrBot/venv/lib/python3.10/site-packages/tenacity/asyncio/__init__.py", line 114, in __call__
result = await fn(*args, **kwargs)
File "/home/qqbot/AstrBot/venv/lib/python3.10/site-packages/google/genai/_api_client.py", line 1310, in _async_request_once
await errors.APIError.raise_for_async_response(response)
File "/home/qqbot/AstrBot/venv/lib/python3.10/site-packages/google/genai/errors.py", line 203, in raise_for_async_response
await cls.raise_error_async(status_code, response_json, response)
File "/home/qqbot/AstrBot/venv/lib/python3.10/site-packages/google/genai/errors.py", line 225, in raise_error_async
raise ClientError(status_code, response_json, response)
google.genai.errors.ClientError: 400 INVALID_ARGUMENT. {'error': {'code': 400, 'message': 'Function calling config is set without function_declarations.', 'status': 'INVALID_ARGUMENT'}}
[2026-04-07 14:54:37.792] [Core] [DBUG] [runners.base:64]: Agent state transition: AgentState.RUNNING -> AgentState.ERROR
[2026-04-07 14:54:37.793] [Core] [DBUG] [result_decorate.stage:165]: hook(on_decorating_result) -> astrbot_plugin_wakepro - on_message
[2026-04-07 14:54:37.793] [Core] [DBUG] [result_decorate.stage:165]: hook(on_decorating_result) -> astrbot_plugin_outputpro - on_message
[2026-04-07 14:54:37.796] [Core] [INFO] [respond.stage:184]: Prepare to send - 逸木/872778579: LLM 响应错误: All chat models failed: ClientError: 400 INVALID_ARGUMENT. {'error': {'code': 400, 'message': 'Function calling config is set without function_declarations.', 'status': 'INVALID_ARGUMENT'}}
[2026-04-07 14:54:38.048] [Core] [DBUG] [pipeline.context_utils:95]: hook(OnAfterMessageSentEvent) -> astrbot - after_message_sent
[2026-04-07 14:54:38.049] [Core] [DBUG] [pipeline.scheduler:93]: pipeline 执行完毕。
Are you willing to submit a PR? / 你愿意提交 PR 吗?
- Yes!
Code of Conduct
- I have read and agree to abide by the project's Code of Conduct。
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:providerThe bug / feature is about AI Provider, Models, LLM Agent, LLM Agent Runner.The bug / feature is about AI Provider, Models, LLM Agent, LLM Agent Runner.bugSomething isn't workingSomething isn't working