LykosAI/StabilityMatrix · error · InvalidOperationException

T5-XXL model not found

Error message

T5-XXL model not found

What it means

The Flux Kontext pipeline also requires the T5-XXL text encoder. SelectModels searches ClipModels for a local file whose name contains 't5xxl' or 't5-xxl' and throws this InvalidOperationException when none is found, because the second encoder slot of the workflow cannot be filled.

Solutions

  1. Download a T5-XXL encoder (e.g. t5xxl_fp8_e4m3fn.safetensors) into the TextEncoders folder and refresh the index
  2. Rename the existing T5 file so it contains 't5xxl' or 't5-xxl' in a scanned folder
  3. Catch InvalidOperationException and offer an in-app T5-XXL download

Example fix

// before
var models = fluxKontextModelManager.SelectModels();
// after
if (!clientManager.ClipModels.Any(m => m.Local != null && m.FileName.Contains("t5xxl", StringComparison.OrdinalIgnoreCase)))
{
    await sharedFolders.DownloadModelAsync(T5XxlFp8Uri, SharedFolderType.TextEncoders);
}
var models = fluxKontextModelManager.SelectModels();
Defensive patterns

Strategy: validation

Validate before calling

var clip2 = clientManager.ClipModels.FirstOrDefault(m => m.Local != null
    && (m.FileName.Contains("t5xxl", StringComparison.OrdinalIgnoreCase)
        || m.FileName.Contains("t5-xxl", StringComparison.OrdinalIgnoreCase)));
if (clip2 is null) throw new UserDownloadableError("T5-XXL encoder is not installed.");

Type guard

bool HasT5Xxl(IEnumerable<HybridModelFile> clips) => clips.Any(m => m.Local != null && (m.FileName.Contains("t5xxl", StringComparison.OrdinalIgnoreCase) || m.FileName.Contains("t5-xxl", StringComparison.OrdinalIgnoreCase)));

Try / catch

try
{
    var models = fluxKontextModelManager.SelectModels();
}
catch (InvalidOperationException ex) when (ex.Message.Contains("T5-XXL model not found"))
{
    // trigger t5xxl download flow
}

Prevention

When it happens

Trigger: Calling SelectModels when no ClipModels entry has Local != null and a filename containing 't5xxl' or 't5-xxl' (case-insensitive).

Common situations: User installs CLIP-L but not t5xxl_fp8_e4m3fn.safetensors; the T5 file uses a naming variant that matches neither substring; encoder folder not scanned or index stale after moving files.

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


AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12). Data as JSON: /api/errors/ec3f455d34dbeaa3. Report an issue: GitHub.

Appendix: source

Thrown at StabilityMatrix.Avalonia/Services/FluxKontextModelManager.cs:192

        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)