{"record":{"id":"0094377bdfbca9dd","repo":"zed-industries/zed","slug":"mistral-does-not-support-custom-tools","errorCode":null,"errorMessage":"Mistral does not support custom tools","messagePattern":"Mistral does not support custom tools","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/language_models/src/provider/mistral.rs","lineNumber":367,"sourceCode":"            };\n        let stream = self.stream_completion(request, affinity, cx);\n\n        async move {\n            let stream = stream.await?;\n            let mapper = MistralEventMapper::new();\n            Ok(mapper.map_stream(stream).boxed())\n        }\n        .boxed()\n    }\n}\n\npub fn into_mistral(\n    request: LanguageModelRequest,\n    model: mistral::Model,\n    max_output_tokens: Option<u64>,\n) -> Result<(mistral::Request, Option<String>)> {\n    if request.contains_custom_tool_input() {\n        anyhow::bail!(\"Mistral does not support custom tools\");\n    }\n\n    let stream = true;\n\n    let mut messages = Vec::new();\n    for message in &request.messages {\n        match message.role {\n            Role::User => {\n                let mut message_content = mistral::MessageContent::empty();\n                for content in &message.content {\n                    match content {\n                        MessageContent::Text(text) => {\n                            message_content\n                                .push_part(mistral::MessagePart::Text { text: text.clone() });\n                        }\n                        MessageContent::Image(image_content) => {\n                            if model.supports_images() {\n                                message_content.push_part(mistral::MessagePart::ImageUrl {","sourceCodeStart":349,"sourceCodeEnd":385,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/language_models/src/provider/mistral.rs#L349-L385","documentation":"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.","triggerScenarios":"Thrown at crates/language_models/src/provider/mistral.rs:367 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Avoid using custom (freeform) tools with Mistral models; define tools with JSON schemas instead","Switch to a provider that supports custom tool input, such as Anthropic or OpenAI","Remove or reset the pending custom tool call in the conversation before retrying"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}