continuedev/continue · error · Error

Unsupported tool call type in Gemini: ${toolCall.type}

Error message

Unsupported tool call type in Gemini: ${toolCall.type}

What it means

The Gemini adapter throws when converting tool calls whose `type` field is not the expected function-call shape (e.g. type: 'custom' or a malformed type string). Only 'function' tool calls are translated to Gemini's functionCall parts.

Source

Thrown at packages/openai-adapters/src/apis/Gemini.ts:196

                      // Fallback per https://ai.google.dev/gemini-api/docs/thought-signatures
                      // for histories that were not generated by Gemini or are missing signatures.
                      thoughtSignature = "skip_thought_signature_validator";
                    }
                  }

                  return {
                    functionCall: {
                      id: includeToolCallIds ? toolCall.id : undefined,
                      name: toolCall.function.name,
                      args: safeParseArgs(
                        toolCall.function.arguments,
                        `Call: ${toolCall.function.name} ${toolCall.id}`,
                      ),
                    },
                    ...(thoughtSignature && { thoughtSignature }),
                  };
                }
                throw new Error(
                  `Unsupported tool call type in Gemini: ${toolCall.type}`,
                );
              },
            ),
          };
        }

        if (msg.role === "tool") {
          const functionName = toolCallIdToNameMap.get(msg.tool_call_id);
          return {
            role: "user" as const,
            parts: [
              {
                functionResponse: {
                  id: includeToolCallIds ? msg.tool_call_id : undefined,
                  name: functionName ?? "unknown",
                  response: {
                    content:

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Filter or map non-function tool calls before sending history to Gemini.
  2. Ensure tool calls you construct use type: 'function'.
  3. Re-serialize tool results as plain text if the custom type can't be expressed.

Example fix

// before
messages: [...historyWithCustomToolCalls]
// after
messages: history.filter(m => (m.tool_calls ?? []).every(tc => tc.type === 'function'))
Defensive patterns

Strategy: validation

Validate before calling

const msgs = history.map(m => ({ ...m, tool_calls: m.tool_calls?.filter(tc => tc.type === 'function') }));

Type guard

const isFunctionToolCall = (tc: any): tc is { type: 'function'; id: string; function: { name: string; arguments: string } } => tc?.type === 'function' && typeof tc?.function?.name === 'string';

Try / catch

catch (e) { if (/Unsupported tool call type/.test(e.message)) return sanitizeToolCallsAndRetry(); throw e; }

Prevention

When it happens

Trigger: Sending a message with tool_calls entries whose type is anything other than 'function' (custom tool types, provider-specific extensions), or replaying assistant messages from another provider verbatim.

Common situations: Cross-provider message replay — history captured from a provider with custom tool types then sent to Gemini; hand-built tool_call objects with missing/misspelled type.

Related errors


AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27). Data as JSON: /api/errors/ee72bf0d54d1f324. Report an issue: GitHub.