zed-industries/zed · error · anyhow::Error
Ollama does not support custom tools
Error message
Ollama does not support custom tools
What it means
Guard in to_ollama_request: the request contains custom tool input that Ollama's chat API cannot encode. The request is rejected locally before serialization, failing the completion instead of sending an unusable payload.
Source
Thrown at crates/language_models/src/provider/ollama.rs:365
"Run local models on your machine with Ollama.".into(),
)),
))
}
}
pub struct OllamaLanguageModel {
id: LanguageModelId,
model: ollama::Model,
http_client: Arc<dyn HttpClient>,
request_limiter: RateLimiter,
state: Entity<State>,
disabled: Option<DisabledReason>,
}
impl OllamaLanguageModel {
fn to_ollama_request(&self, request: LanguageModelRequest) -> Result<ChatRequest> {
if request.contains_custom_tool_input() {
anyhow::bail!("Ollama does not support custom tools");
}
let supports_vision = self.model.supports_vision.unwrap_or(false);
let mut messages = Vec::with_capacity(request.messages.len());
for mut msg in request.messages.into_iter() {
let images = if supports_vision {
msg.content
.iter()
.filter_map(|content| match content {
MessageContent::Image(image) => Some(image.source.to_string()),
_ => None,
})
.collect::<Vec<String>>()
} else {
vec![]
};View on GitHub (pinned to f4178619ac)
Solutions
- Replace custom tools with JSON-schema-defined tools when targeting Ollama
- Use a provider with custom-tool support for this session
- Clear the outstanding custom tool call from the message history and retry
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/language_models/src/provider/ollama.rs:365 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/42a1cec35c183ca3.
Report an issue: GitHub.