LykosAI/StabilityMatrix · error · InvalidOperationException
Qwen Image Edit UNET model not found
Error message
Qwen Image Edit UNET model not found
What it means
QwenImageEditModelManager.SelectModels throws this InvalidOperationException when the connected client's UNET model list contains no local model whose file name contains 'qwen_image_edit' or 'qwen-image-edit' (case-insensitive). The workflow requires that specific checkpoint to build the Qwen Image Edit graph.
Solutions
- Download the Qwen Image Edit UNET model into ComfyUI's models/unet (diffusion_models) directory
- Ensure the file name contains 'qwen_image_edit' or 'qwen-image-edit' (no arbitrary renaming)
- Rescan/refresh the model list in ComfyUI so it appears in clientManager.UnetModels with a Local entry
- Verify the manager's connection is fresh (UnetModels populated from the current server) and retry
Example fix
// before
var models = manager.SelectModels(); // throws if UNET missing
// after
var hasQwen = clientManager.UnetModels.Any(m => m.Local != null
&& (m.FileName.Contains("qwen_image_edit", StringComparison.OrdinalIgnoreCase)
|| m.FileName.Contains("qwen-image-edit", StringComparison.OrdinalIgnoreCase)));
if (!hasQwen)
{
throw new InvalidOperationException("Download the Qwen Image Edit UNET model into models/unet first");
}
var models = manager.SelectModels(); Defensive patterns
Strategy: validation
Validate before calling
var unet = clientManager.UnetModels.FirstOrDefault(m => m.Local != null
&& (m.FileName.Contains("qwen_image_edit", StringComparison.OrdinalIgnoreCase)
|| m.FileName.Contains("qwen-image-edit", StringComparison.OrdinalIgnoreCase)));
if (unet is null)
throw new InvalidOperationException("Qwen Image Edit UNET model not downloaded"); Type guard
bool HasQwenEditUnet(InferenceClientManager m) => m.UnetModels.Any(u => u.Local != null
&& (u.FileName.Contains("qwen_image_edit", StringComparison.OrdinalIgnoreCase)
|| u.FileName.Contains("qwen-image-edit", StringComparison.OrdinalIgnoreCase))); Try / catch
try
{
var models = qwenManager.SelectModels();
}
catch (InvalidOperationException ex) when (ex.Message.Contains("Qwen"))
{
// guide user to download the required model files
} Prevention
- Pre-flight check the model list before launching the workflow
- Keep model file names intact (matching substrings)
- Rescan ComfyUI models after adding files
- Download all required pieces (UNET, VAE, text encoders) together
When it happens
Trigger: Running the Qwen Image Edit workflow while the required qwen_image_edit UNET diffusion model is absent from the ComfyUI models/unet (or diffusion_models) directory, or is present but not registered locally (m.Local == null).
Common situations: User never downloaded the Qwen Image Edit model; model placed in the wrong folder (checkpoints instead of unet); file renamed so the 'qwen_image_edit'/'qwen-image-edit' substring no longer matches; ComfyUI not rescanned after adding the model.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Qwen Image VAE model not found
- Qwen Image Edit requires the Qwen2.5-VL 7B text encoder…
- No Clip3 Selected
- No Clip4 Selected
- Length cannot be null when latentType is Hunyuan
AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12).
Data as JSON: /api/errors/1e1513023d5311f3.
Report an issue: GitHub.
Appendix: source
Thrown at StabilityMatrix.Avalonia/Services/QwenImageEditModelManager.cs:134
_ => model.FileName,
};
yield return name;
}
}
/// <summary>
/// Select the best available models for Qwen Image Edit (only selects LOCAL models)
/// </summary>
internal SelectedModels SelectModels(IInferenceClientManager clientManager)
{
var unetModel =
clientManager.UnetModels.FirstOrDefault(m =>
m.Local != null
&& (
m.FileName.Contains("qwen_image_edit", StringComparison.OrdinalIgnoreCase)
|| m.FileName.Contains("qwen-image-edit", StringComparison.OrdinalIgnoreCase)
)
) ?? throw new InvalidOperationException("Qwen Image Edit UNET model not found");
var vaeModel =
clientManager.VaeModels.FirstOrDefault(m =>
m.Local != null && m.FileName.Contains("qwen_image_vae", StringComparison.OrdinalIgnoreCase)
) ?? throw new InvalidOperationException("Qwen Image VAE model not found");
// Prefer an explicit 7B match, then any VL encoder without a size hint (could be a
// renamed 7B). Smaller VL encoders (e.g. the 3B, hidden size 2048) load fine but die
// mid-sampling with "expected input with shape [*, 3584]", so fail fast with a clear
// message instead of silently picking one.
var clipModel =
clientManager.ClipModels.FirstOrDefault(m =>
m.Local != null
&& IsQwenVlEncoder(m.FileName)
&& m.FileName.Contains("7b", StringComparison.OrdinalIgnoreCase)
)
?? clientManager.ClipModels.FirstOrDefault(m =>
m.Local != null && IsUsableQwenVlEncoder(m.FileName)View on GitHub (pinned to af93d6ef57)