You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tool call streaming fails with 'missing id or name' on OpenAI-compatible APIs that send empty-string deltas #37841
When using an OpenAI-compatible API (DashScope token-plan endpoint with GLM-5.2), tool calls fail with:
OpenAI Chat tool call delta is missing id or name
The root cause is that some OpenAI-compatible APIs send empty strings ("") for id and function.name on subsequent tool call deltas instead of omitting them or sending null. For example:
In ToolStream.appendOrStart, the nullish coalescing operator (??) does not treat "" as absent, so the fallback to accumulated values never triggers. The !id check then fails on the empty string.
OpenCode version
v2 branch (also affects published opencode2 next builds)
Steps to reproduce
Configure an OpenAI-compatible provider pointing to DashScope token-plan endpoint (token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1)
Add a model like glm-5.2 with tool_call: true
Send a prompt that triggers a tool call
The streaming response fails on the second tool call delta
If these are the same root cause, it would be helpful to consolidate discussion there. If your issue is distinct (e.g., specifically about empty-string deltas vs. missing fields), please note that in a comment.
Activity
github-actions commentedon Jul 20, 2026
This issue might be a duplicate of existing issues. Please check:
If these are the same root cause, it would be helpful to consolidate discussion there. If your issue is distinct (e.g., specifically about empty-string deltas vs. missing fields), please note that in a comment.
Garfier commentedon Jul 20, 2026
Already fixed in v2 branch — upstream changed
appendOrStartto prefer accumulated identity (current?.id ?? delta.id), which handles empty-string deltas correctly.