LykosAI/StabilityMatrix · error · InvalidOperationException
CLIP-L model not found
Error message
CLIP-L model not found
What it means
The Flux Kontext pipeline needs the CLIP-L text encoder (first of two encoders). SelectModels looks for a local ClipModels file whose name contains 'clip_l' and throws this InvalidOperationException when none is installed, since the workflow cannot be built without it.
Solutions
- Download clip_l.safetensors into the TextEncoders folder and refresh the index
- Ensure the filename contains the substring 'clip_l' (underscore) in a scanned folder
- Catch InvalidOperationException and offer an in-app download of clip_l
Example fix
// before
var models = fluxKontextModelManager.SelectModels();
// after
if (!clientManager.ClipModels.Any(m => m.Local != null && m.FileName.Contains("clip_l", StringComparison.OrdinalIgnoreCase)))
{
await sharedFolders.DownloadModelAsync(ClipLSafetensorsUri, SharedFolderType.TextEncoders);
}
var models = fluxKontextModelManager.SelectModels(); Defensive patterns
Strategy: validation
Validate before calling
var clip1 = clientManager.ClipModels.FirstOrDefault(m => m.Local != null
&& m.FileName.Contains("clip_l", StringComparison.OrdinalIgnoreCase));
if (clip1 is null) throw new UserDownloadableError("clip_l.safetensors is not installed."); Type guard
bool HasClipL(IEnumerable<HybridModelFile> clips) => clips.Any(m => m.Local != null && m.FileName.Contains("clip_l", StringComparison.OrdinalIgnoreCase)); Try / catch
try
{
var models = fluxKontextModelManager.SelectModels();
}
catch (InvalidOperationException ex) when (ex.Message.Contains("CLIP-L model not found"))
{
// trigger clip_l download flow
} Prevention
- Keep the filename substring 'clip_l' (underscore) intact
- Download both CLIP-L and T5-XXL encoders as a pair
- Verify encoders are in a folder the client manager scans
When it happens
Trigger: Calling SelectModels when no ClipModels entry has Local != null and a filename containing 'clip_l' (case-insensitive).
Common situations: User installs the T5-XXL encoder but skips clip_l.safetensors; file renamed (e.g. clip-l.safetensors with a hyphen would still contain 'clip_l'? no — hyphen breaks the match); encoders placed in a non-scanned folder.
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
- Flux.2 Klein UNET model not found
- Flux.2 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…
- Flux Kontext UNET model not found
AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12).
Data as JSON: /api/errors/03ebeafe57f115c7.
Report an issue: GitHub.
Appendix: source
Thrown at StabilityMatrix.Avalonia/Services/FluxKontextModelManager.cs:183
{
var unetModel =
clientManager.UnetModels.FirstOrDefault(m =>
m.Local != null
&& (
m.FileName.Contains("flux1-dev-kontext", StringComparison.OrdinalIgnoreCase)
|| m.FileName.Contains("flux-kontext", StringComparison.OrdinalIgnoreCase)
)
) ?? throw new InvalidOperationException("Flux Kontext UNET model not found");
var vaeModel =
clientManager.VaeModels.FirstOrDefault(m =>
m.Local != null && m.FileName.Equals("ae.safetensors", StringComparison.OrdinalIgnoreCase)
) ?? throw new InvalidOperationException("Flux VAE model not found");
var clip1Model =
clientManager.ClipModels.FirstOrDefault(m =>
m.Local != null && m.FileName.Contains("clip_l", StringComparison.OrdinalIgnoreCase)
) ?? throw new InvalidOperationException("CLIP-L model not found");
var clip2Model =
clientManager.ClipModels.FirstOrDefault(m =>
m.Local != null
&& (
m.FileName.Contains("t5xxl", StringComparison.OrdinalIgnoreCase)
|| m.FileName.Contains("t5-xxl", StringComparison.OrdinalIgnoreCase)
)
) ?? throw new InvalidOperationException("T5-XXL model not found");
return new FluxKontextWorkflowBuilder.SelectedModels(unetModel, vaeModel, clip1Model, clip2Model);
}
}
View on GitHub (pinned to af93d6ef57)