[PR #4590] Fix empty tool call ID causing API errors when switching providers #11033

Closed
opened 2026-02-16 18:15:48 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/4590

State: closed
Merged: No


close #1279

Problem

Some providers (e.g. Gemini) don't generate tool call IDs, resulting in empty callID being stored. When switching to providers that require tool call IDs (e.g. Anthropic, OpenAI), this causes API errors with "id": "" in tool_use blocks.

Solution

  • Generate fallback ulid() when value.id is empty from stream events
  • Make toModelMessage async to fix empty callID in existing stored data
  • Update storage with generated ID when empty callID is found

Test plan

  • Use Gemini model to create tool calls in a session
  • Switch to Anthropic/OpenAI model and continue the session
  • Verify no API errors about empty tool call IDs
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/4590 **State:** closed **Merged:** No --- close #1279 **Problem** Some providers (e.g. Gemini) don't generate tool call IDs, resulting in empty callID being stored. When switching to providers that require tool call IDs (e.g. Anthropic, OpenAI), this causes API errors with "id": "" in tool_use blocks. **Solution** - Generate fallback ulid() when value.id is empty from stream events - Make toModelMessage async to fix empty callID in existing stored data - Update storage with generated ID when empty callID is found **Test plan** - Use Gemini model to create tool calls in a session - Switch to Anthropic/OpenAI model and continue the session - Verify no API errors about empty tool call IDs
yindo added the pull-request label 2026-02-16 18:15:48 -05:00
yindo closed this issue 2026-02-16 18:15:48 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11033