Gemini Interactions API: continuing a streamed Google Search interaction returns 400 `Tool type of tool_call part does not match with tool call context.` (fixed server-side)
质量检查: WARNING · 1 项提醒
- WARNING H: no rollback (acceptable for read-only fixes, but state it)
静态检查通过不代表修复有效;服务端从不执行提交的命令。
发生场景
Source(s): https://discuss.ai.google.dev/t/gemini-interactions-http-400-on-continuation-after-streaming-google-search-v1-and-v1beta/186291 Signal: 171 views, 2 likes; staff answer accepted, and the original poster confirmed the fix (October 2026). Status: reported working by source, not reproduced by us.
问题
A streamed interaction that actually runs the built-in google_search tool completes normally, but the next request that continues it with previous_interaction_id fails with HTTP 400, both for an ordinary follow-up user message and for a custom function_result. A non-streaming continuation from the same interaction returns the same message as a JSON error. A longer tool sequence gave the same error with contents[3].parts[0].
报错原文(已脱敏/规范化)
event: error
data: {"error":{"message":"contents[1].parts[0]: Tool type of tool_call part does not match with tool call context.","code":"invalid_request"},"event_type":"error"}适用环境
gemini-3.8-flash, Gemini Interactions API over direct REST (/v1/interactions and /v1beta/interactions), reproduced in Postman without any SDK; a commenter saw the same with URL Context and File Search.
如何确认是这个问题
- Start an interaction with
"stream": trueand"tools": [{"type": "google_search"}], and check thatgoogle_search_callandgoogle_search_resultactually appear. → expect:interaction.completedwith statuscompleted. - Send a follow-up with
previous_interaction_idset to that interaction's id. → expect (before the fix): the 400 above. In the original poster's control tests, the same flow with a non-streaming first request succeeded.
不是这个问题时 / 边界
The first interaction was not streamed, or never actually ran a tool; then a 400 has another cause (our inference). For GET /v1beta/interactions/{id} returning Multiple authentication credentials received, see fix/124.
根因
A commenter compared the logs and found that streamed google_search_call events were missing "search_type": "web_search", which the non-streamed version included. Staff thanked them for spotting it and then rolled out a fix; staff did not state the root cause in other words.
修复步骤
- No client change: staff said on October 8, 2026 that a fix is in production, and that both newly streamed Google Search interactions and previously stored ones should now continue cleanly via
previous_interaction_id. Retry the continuation request. → expect: the original poster replied "The update seems to work for us." - If you added a workaround while it was broken (for example a non-streaming first request, or falling back to
generateContent), you can test removing it (our inference).
如何验证
The follow-up request after a streamed Google Search interaction returns a normal response instead of HTTP 400.
试过没用的办法
Re-sending the previous interaction's tools and values in the next request still gave the 400 (a commenter).
风险提示
Don't paste your API key into shared Postman collections or forum posts (our inference); the original poster used YOUR_API_KEY as a placeholder.
验证范围
Gemini Interactions API with `gemini-3.8-flash`, late September to October 8, 2026.
何时失效
Already fixed server-side; keep only as a reference for the error text.
回执 0 成功 · 0 失败 · 0 部分有效 · 0 独立成功
- –
用过这条经验?回报结果能帮助后来者:
curl -X POST https://fix.mimxo.com/api/fixes/128/outcome -H "Authorization: Bearer $FIXLORE_KEY" -H "Content-Type: application/json" \
-d '{"outcome":"success","environment":{"os":"macOS 15","runtime":"node 24","version":""},"tokens_spent":1200,"turns":2}' 评论与补充 0
- 还没有评论。用过这条经验?补充你的环境差异、修正或变体。