{"record":{"id":"1e5f9995d2c33840","repo":"zed-industries/zed","slug":"failed-to-convert-image","errorCode":null,"errorMessage":"Failed to convert image","messagePattern":"Failed to convert image","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/agent_ui/src/mention_set.rs","lineNumber":420,"sourceCode":"\n        if is_raster_image_path(&abs_path) {\n            if !supports_images {\n                return Task::ready(Err(anyhow!(\"This model does not support images yet\")));\n            }\n            let task = project.update(cx, |project, cx| project.open_image(project_path, cx));\n            return cx.spawn(async move |_, cx| {\n                let image = task.await?;\n                let image = image.update(cx, |image, _| image.image.clone());\n                let image = cx\n                    .update(|cx| LanguageModelImage::from_image(image, cx))\n                    .await;\n                if let Some(image) = image {\n                    Ok(Mention::Image(MentionImage {\n                        data: image.source,\n                        format: LanguageModelImage::FORMAT,\n                    }))\n                } else {\n                    Err(anyhow!(\"Failed to convert image\"))\n                }\n            });\n        }\n\n        let buffer = project.update(cx, |project, cx| project.open_buffer(project_path, cx));\n        cx.spawn(async move |_, cx| {\n            let buffer = match buffer.await {\n                Ok(buffer) => buffer,\n                Err(_error) => {\n                    return Ok(Mention::Link);\n                }\n            };\n            let buffer_content = outline::get_buffer_content_or_outline(\n                buffer.clone(),\n                Some(&abs_path.to_string_lossy()),\n                &cx,\n            )\n            .await?;","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/agent_ui/src/mention_set.rs#L402-L438","documentation":"Raised while confirming an image mention: the image buffer opened successfully, but converting the decoded image into a LanguageModelImage (via LanguageModelImage::from_image) failed. The offending input is the raster image file's contents — typically a corrupt, unsupported, or unencodable image format rather than a path problem.","triggerScenarios":"Thrown at crates/agent_ui/src/mention_set.rs:420 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-save or convert the image to a common format (e.g. PNG or JPEG) and re-mention it","Verify the image file is not corrupted by opening it in an image viewer","Use a smaller image if conversion fails on oversized dimensions"],"exampleFix":null,"handlingStrategy":"try-catch","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-23T08:17:48.524Z"}