Mintplex-Labs/anything-llm · error · Error
Gemini: does not support tool calling.
Error message
Gemini: ${this.model} does not support tool calling. What it means
Capability guard in the Gemini agent provider's stream method: the selected model reports no tool-calling support, but the agent flow requires function/tool execution, so the stream attempt is rejected before any request is sent.
Solutions
- Switch to a Gemini model that supports function/tool calling (e.g. gemini-1.5-pro or newer).
- Disable tool calling for this agent when using this model.
Defensive patterns
Strategy: validation
When it happens
Trigger: The configured Gemini model does not support tool calling but the agent invoked tools.
Common situations: This error is raised at runtime in server/utils/agents/aibitat/providers/gemini.js. It occurs when the required configuration for this provider is missing or invalid (unset environment variables, empty API key or base path), when the external service is unreachable or returns an unexpected response, or when invalid input reaches the call site. To prevent it, validate the relevant provider settings and environment variables at startup and confirm the service is reachable before this code path executes.
AI-assisted analysis of Mintplex-Labs/anything-llm@20f6d3546c (2026-08-18).
Data as JSON: /api/errors/6cd55570be9cb1e7.
Report an issue: GitHub.
Appendix: source
Thrown at server/utils/agents/aibitat/providers/gemini.js:248
// ignore
}
}
}
#formatFunctions(functions) {
return functions.map((func) => ({
type: "function",
function: {
name: this.prefixToolCall(func.name, "add"),
description: func.description,
parameters: func.parameters,
},
}));
}
async stream(messages, functions = [], eventHandler = null) {
if (!this.supportsToolCalling)
throw new Error(`Gemini: ${this.model} does not support tool calling.`);
this.providerLog("Gemini.stream - will process this chat completion.");
this.resetUsage();
try {
const msgUUID = v4();
/** @type {OpenAI.OpenAI.Chat.ChatCompletion} */
const response = await this.client.chat.completions.create({
model: this.model,
messages: this.#formatMessages(messages),
stream: true,
stream_options: { include_usage: true },
...(Array.isArray(functions) && functions?.length > 0
? {
tools: this.#formatFunctions(functions),
tool_choice: "auto",
// AIbitat runs one tool per turn; parallel calls cause a 400
// on the next request due to a tool call/result count mismatch.
parallel_tool_calls: false,View on GitHub (pinned to 20f6d3546c)