zed-industries/zed · error

Ollama does not support custom tool calls

Error message

Ollama does not support custom tool calls

What it means

Raised during Ollama request conversion (OllamaFunctionCall path): the incoming language-model request uses custom tool calls that the Ollama provider's conversion does not support, so it errors instead of silently dropping the tool.

Source

Thrown at crates/language_models/src/provider/ollama.rs:434

                    for content in msg.content.into_iter() {
                        match content {
                            MessageContent::Text(text) => {
                                text_content.push_str(&text);
                            }
                            MessageContent::Thinking { text, .. } if !text.is_empty() => {
                                thinking = Some(text)
                            }
                            MessageContent::ToolUse(tool_use) => {
                                tool_calls.push(OllamaToolCall {
                                    id: tool_use.id.to_string(),
                                    function: OllamaFunctionCall {
                                        name: tool_use.name.to_string(),
                                        arguments: match tool_use.input {
                                            language_model::LanguageModelToolUseInput::Json(
                                                input,
                                            ) => input,
                                            language_model::LanguageModelToolUseInput::Text(_) => {
                                                return Err(anyhow::anyhow!(
                                                    "Ollama does not support custom tool calls"
                                                ));
                                            }
                                        },
                                    },
                                });
                            }
                            _ => (),
                        }
                    }
                    messages.push(ChatMessage::Assistant {
                        content: text_content,
                        tool_calls: Some(tool_calls),
                        images: if images.is_empty() {
                            None
                        } else {
                            Some(images)
                        },

View on GitHub (pinned to f4178619ac)

Solutions

  1. Disable custom tools with Ollama models
  2. Use Ollama's native tool schema (built-in tool definitions) instead
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/language_models/src/provider/ollama.rs:434 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/9f2dac2e0a470d45. Report an issue: GitHub.