zed-industries/zed · error · anyhow::Error

Mistral does not support custom tools

Error message

Mistral does not support custom tools

What it means

Guard in into_mistral: the request carries a model-generated custom tool input (tool-call results that don't fit the JSON tool schema), which Mistral's API cannot represent. The conversion aborts before any network request is made, so the whole completion fails rather than silently dropping tool context.

Source

Thrown at crates/language_models/src/provider/mistral.rs:367

            };
        let stream = self.stream_completion(request, affinity, cx);

        async move {
            let stream = stream.await?;
            let mapper = MistralEventMapper::new();
            Ok(mapper.map_stream(stream).boxed())
        }
        .boxed()
    }
}

pub fn into_mistral(
    request: LanguageModelRequest,
    model: mistral::Model,
    max_output_tokens: Option<u64>,
) -> Result<(mistral::Request, Option<String>)> {
    if request.contains_custom_tool_input() {
        anyhow::bail!("Mistral does not support custom tools");
    }

    let stream = true;

    let mut messages = Vec::new();
    for message in &request.messages {
        match message.role {
            Role::User => {
                let mut message_content = mistral::MessageContent::empty();
                for content in &message.content {
                    match content {
                        MessageContent::Text(text) => {
                            message_content
                                .push_part(mistral::MessagePart::Text { text: text.clone() });
                        }
                        MessageContent::Image(image_content) => {
                            if model.supports_images() {
                                message_content.push_part(mistral::MessagePart::ImageUrl {

View on GitHub (pinned to f4178619ac)

Solutions

  1. Avoid using custom (freeform) tools with Mistral models; define tools with JSON schemas instead
  2. Switch to a provider that supports custom tool input, such as Anthropic or OpenAI
  3. Remove or reset the pending custom tool call in the conversation before retrying
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/language_models/src/provider/mistral.rs:367 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/0094377bdfbca9dd. Report an issue: GitHub.