zed-industries/zed · error

llama.cpp does not support custom tool calls

Error message

llama.cpp does not support custom tool calls

What it means

Guard in build_llama_cpp_request: a MessageContent::ToolUse carrying custom tool input cannot be expressed in llama.cpp's message schema, so request building fails instead of emitting a tool call the local server would reject.

Source

Thrown at crates/language_models/src/provider/llama_cpp.rs:749

                            llama_cpp::MessagePart::Image {
                                image_url: llama_cpp::ImageUrl {
                                    url: image.to_base64_url(),
                                    detail: None,
                                },
                            },
                            message.role,
                            &mut messages,
                            if supports_thinking && message.role == Role::Assistant {
                                reasoning_content.take()
                            } else {
                                None
                            },
                        );
                    }
                }
                MessageContent::ToolUse(tool_use) => {
                    let input = tool_use.input.as_json().ok_or_else(|| {
                        anyhow::anyhow!("llama.cpp does not support custom tool calls")
                    })?;
                    let tool_call = llama_cpp::ToolCall {
                        id: tool_use.id.to_string(),
                        content: llama_cpp::ToolCallContent::Function {
                            function: llama_cpp::FunctionContent {
                                name: tool_use.name.to_string(),
                                arguments: serde_json::to_string(input).unwrap_or_default(),
                            },
                        },
                    };

                    if let Some(llama_cpp::ChatMessage::Assistant {
                        tool_calls,
                        reasoning_content: message_reasoning_content,
                        ..
                    }) = messages.last_mut()
                    {
                        append_reasoning_content(

View on GitHub (pinned to 5a9b9558db)

Solutions

  1. Disable custom tools for llama.cpp models
  2. Use a llama.cpp model/server variant that supports the needed tool format
Defensive patterns

Strategy: validation

When it happens

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

Common situations: See trigger scenarios.


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