What happened / 发生了什么
When using Gemini models through OpenAI-compatible proxy services (e.g. continue proxy), streaming tool_call chunks
are missing the index field required by the openai SDK's ChatCompletionStreamState. This causes tool_call
arguments to be silently dropped, resulting in None arguments and AttributeError crash in
tool_loop_agent_runner.py.
Error log:
[WARN] Saving chunk state error: Expected list delta entry to have an index key; {'id': '', 'function': {'arguments':
'{"content":"...","tags":"..."}'}, 'type': ''}
[INFO] 使用工具:memory_save,参数:None
AttributeError: 'NoneType' object has no attribute 'items'
Root cause: Standard OpenAI streaming chunks include {"index": 0, ...} in tool_call deltas. Gemini proxies omit this
field, causing ChatCompletionStreamState.handle_chunk() to reject the chunk and lose the arguments.
Impact: All tool_call arguments become None when streaming is enabled with Gemini proxy, affecting any registered tool
(plugins, MCP tools, etc).
Reproduce / 如何复现?
- Configure a Gemini model via an OpenAI-compatible proxy
- Enable streaming (webchat forces
enable_streaming=True by default)
- Send a message that triggers any tool call
- Observe: tool arguments are None, tool execution crashes
AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器
v4.20.1
OS
Linux
Logs / 报错日志
[WARN] Saving chunk state error: Expected list delta entry to have an index key; {'id': '', 'function': {'arguments':
'{"content":"...","tags":"..."}'}, 'type': ''}
[INFO] 使用工具:memory_save,参数:None
AttributeError: 'NoneType' object has no attribute 'items'
Are you willing to submit a PR? / 你愿意提交 PR 吗?
Code of Conduct
What happened / 发生了什么
When using Gemini models through OpenAI-compatible proxy services (e.g.
continueproxy), streaming tool_call chunksare missing the
indexfield required by the openai SDK'sChatCompletionStreamState. This causes tool_callarguments to be silently dropped, resulting in
Nonearguments andAttributeErrorcrash intool_loop_agent_runner.py.Error log:
[WARN] Saving chunk state error: Expected list delta entry to have an index key; {'id': '', 'function': {'arguments':
'{"content":"...","tags":"..."}'}, 'type': ''}
[INFO] 使用工具:memory_save,参数:None
AttributeError: 'NoneType' object has no attribute 'items'
Root cause: Standard OpenAI streaming chunks include
{"index": 0, ...}in tool_call deltas. Gemini proxies omit thisfield, causing
ChatCompletionStreamState.handle_chunk()to reject the chunk and lose the arguments.Impact: All tool_call arguments become None when streaming is enabled with Gemini proxy, affecting any registered tool
(plugins, MCP tools, etc).
Reproduce / 如何复现?
enable_streaming=Trueby default)AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器
v4.20.1
OS
Linux
Logs / 报错日志
[WARN] Saving chunk state error: Expected list delta entry to have an index key; {'id': '', 'function': {'arguments':
'{"content":"...","tags":"..."}'}, 'type': ''}
[INFO] 使用工具:memory_save,参数:None
AttributeError: 'NoneType' object has no attribute 'items'
Are you willing to submit a PR? / 你愿意提交 PR 吗?
Code of Conduct