LykosAI/StabilityMatrix · error · InvalidOperationException
Qwen Image Edit requires the Qwen2.5-VL 7B text encoder…
Error message
Qwen Image Edit requires the Qwen2.5-VL 7B text encoder, but only a different-size VL encoder was found (smaller variants fail with a tensor shape mismatch). Download qwen_2.5_vl_7b_fp8_scaled.safetensors from huggingface.co/Comfy-Org/Qwen-Image_ComfyUI and place it in your TextEncoders folder.|Qwen 2.5 VL CLIP model not found
What it means
Thrown by QwenImageEditModelManager.SelectModels when no usable Qwen2.5-VL text encoder can be selected. If any VL encoder exists but is not the 7B variant, a detailed message explains that only the 7B encoder works (smaller variants crash mid-sampling with a tensor shape mismatch); if no VL encoder is indexed at all, the plain 'Qwen 2.5 VL CLIP model not found' message is used. Note the thrown string concatenates both messages with a '|' separator, which is why the error text shows both.
Solutions
- Download qwen_2.5_vl_7b_fp8_scaled.safetensors from huggingface.co/Comfy-Org/Qwen-Image_ComfyUI into the TextEncoders folder
- Keep the '7b' token in the filename so the explicit 7B match succeeds
- Remove or rename non-7B VL encoders that could be picked by the ambiguous fallback path
- Refresh the model index / restart so clientManager.ClipModels sees the encoder
Example fix
// before (only 3B encoder installed -> throw) // after: ensure the exact 7B file is present // models/text_encoders/qwen_2.5_vl_7b_fp8_scaled.safetensors SelectModels(models); // now resolves the 7B match
Defensive patterns
Strategy: validation
Validate before calling
bool has7B = models.Clip.Any(c => c.FileName?.Contains("qwen_2.5_vl", StringComparison.OrdinalIgnoreCase) == true && c.FileName.Contains("7b", StringComparison.OrdinalIgnoreCase));
if (!has7B) throw new InvalidOperationException("Install qwen_2.5_vl_7b_fp8_scaled.safetensors"); Try / catch
try { manager.SelectModels(models); }
catch (InvalidOperationException ex) when (ex.Message.Contains("Qwen2.5-VL 7B"))
{
logger.LogWarning(ex, "Missing or wrong-size Qwen VL encoder");
await PromptDownload7bEncoderAsync();
} Prevention
- Download exactly qwen_2.5_vl_7b_fp8_scaled.safetensors, not smaller VL variants
- Place encoders in the TextEncoders folder and keep '7b' in the filename
- Remove 3B VL encoders from TextEncoders to avoid ambiguous fallbacks
When it happens
Trigger: Calling SelectModels when (a) no CLIP model with a Qwen VL encoder filename is indexed, or (b) only a non-7B VL encoder (e.g. the 3B) is present, so neither the explicit 7B match nor the size-hint-free fallback can be satisfied.
Common situations: Downloading qwen_2.5_vl_3b instead of the required 7B encoder; encoder placed outside the TextEncoders folder so ClipModels doesn't index it; renamed file losing the '7b' hint so only the fallback branch applies and the fallback also fails.
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
- Klein 9B requires the qwen_3_8b text encoder, which isn't…
- Klein 4B requires the qwen_3_4b text encoder, which isn't…
- Qwen Image Edit UNET model not found
- No Clip Model Selected
AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12).
Data as JSON: /api/errors/4434c1d312bdf12e.
Report an issue: GitHub.
Appendix: source
Thrown at StabilityMatrix.Avalonia/Services/QwenImageEditModelManager.cs:154
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)
)
?? throw new InvalidOperationException(
clientManager.ClipModels.Any(m => m.Local != null && IsQwenVlEncoder(m.FileName))
? "Qwen Image Edit requires the Qwen2.5-VL 7B text encoder, but only a different-size "
+ "VL encoder was found (smaller variants fail with a tensor shape mismatch). "
+ "Download qwen_2.5_vl_7b_fp8_scaled.safetensors from "
+ "huggingface.co/Comfy-Org/Qwen-Image_ComfyUI and place it in your TextEncoders folder."
: "Qwen 2.5 VL CLIP model not found"
);
return new SelectedModels(unetModel, vaeModel, clipModel);
}
private static bool IsQwenVlEncoder(string fileName) =>
fileName.Contains("qwen", StringComparison.OrdinalIgnoreCase)
&& fileName.Contains("vl", StringComparison.OrdinalIgnoreCase);
// Qwen Image Edit pairs with the Qwen2.5-VL **7B** encoder (hidden size 3584). Other
// sizes produce "Given normalized_shape=[3584], expected input with shape [*, 3584]"
// deep in the sampler, so they are treated as not installed. Files without any sizeView on GitHub (pinned to af93d6ef57)