zed-industries/zed · error

LM Studio does not support custom tool calls

Error message

LM Studio does not support custom tool calls

What it means

Raised in to_lmstudio_request: the language-model request contained a custom tool (LanguageModelToolUse/function tool), which the LM Studio provider's request conversion does not map. The provider cannot represent these tools in its API request.

Source

Thrown at crates/language_models/src/provider/lmstudio.rs:368

                    ),
                    MessageContent::Thinking { .. } => {}
                    MessageContent::RedactedThinking(_) => {}
                    MessageContent::Compaction(_) => {}
                    MessageContent::Image(image) => {
                        add_message_content_part(
                            lmstudio::MessagePart::Image {
                                image_url: lmstudio::ImageUrl {
                                    url: image.to_base64_url(),
                                    detail: None,
                                },
                            },
                            message.role,
                            &mut messages,
                        );
                    }
                    MessageContent::ToolUse(tool_use) => {
                        let input = tool_use.input.as_json().ok_or_else(|| {
                            anyhow!("LM Studio does not support custom tool calls")
                        })?;
                        let tool_call = lmstudio::ToolCall {
                            id: tool_use.id.to_string(),
                            content: lmstudio::ToolCallContent::Function {
                                function: lmstudio::FunctionContent {
                                    name: tool_use.name.to_string(),
                                    arguments: serde_json::to_string(input).unwrap_or_default(),
                                },
                            },
                        };

                        if let Some(lmstudio::ChatMessage::Assistant { tool_calls, .. }) =
                            messages.last_mut()
                        {
                            tool_calls.push(tool_call);
                        } else {
                            messages.push(lmstudio::ChatMessage::Assistant {
                                content: None,

View on GitHub (pinned to 5a9b9558db)

Solutions

  1. Disable custom tools when targeting LM Studio
  2. Update LM Studio to a version supporting the required tool schema, or use built-in tools only
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/language_models/src/provider/lmstudio.rs:373 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/36f5c215dfd3ca3e. Report an issue: GitHub.