LykosAI/StabilityMatrix · error · ValidationException
No text encoders configured. Please select at least one…
Error message
No text encoders configured. Please select at least one encoder model.
What it means
ModelCardViewModel's base-CLIP setup throws this ValidationException when none of the supported text-encoder slots (e.g. Clip1/Clip2) holds a valid selection, so the workflow builder reaches the final 'else' branch with nothing to wire into Connections.Base.Clip. ComfyUI text-to-image workflows require at least one text encoder, so the library fails fast.
Solutions
- Select at least one text encoder model in the model card (Clip1 or Clip2 slot).
- Programmatically assign SelectedClip1 (plus ClipType) or SelectedClip2 with a valid HybridModelFile before generating.
- If the checkpoint truly needs no external encoder, use the correct checkpoint-only model type/card so the encoder branch is not entered.
- Validate encoder selections in UI before enabling the Generate button.
Example fix
// before card.SelectedClip1 = null; card.SelectedClip2 = null; await vm.Generate(); // throws // after card.SelectedClip1 = installedTextEncoder; card.SelectedClipType = ComfyClipType.ClipL; await vm.Generate();
Defensive patterns
Strategy: validation
Validate before calling
bool hasEncoder = card.SelectedClip1 is { IsNone: false } || card.SelectedClip2 is { IsNone: false };
if (!hasEncoder) throw new InvalidOperationException("Select at least one text encoder"); Type guard
var encodersConfigured = new[] { card.SelectedClip1, card.SelectedClip2 }.Any(c => c is { IsNone: false }); Try / catch
try { await vm.Generate(); }
catch (ValidationException ex) when (ex.Message.StartsWith("No text encoders configured"))
{
// guide user to select a text encoder model
} Prevention
- Require an encoder selection before enabling generation for model types that need one.
- After importing presets, verify encoder slots actually resolved to installed files.
- Show inline validation markers on empty encoder slots.
When it happens
Trigger: Running the inference workflow with a model card where SelectedClip1 is null/None and all other encoder slots are also unset — i.e. no text encoder file is configured at all.
Common situations: Fresh model card for a checkpoint the user believes bundles its own CLIP but the card still requires encoder selection; user cleared encoder selections while troubleshooting; imported preset with encoder paths that failed to resolve to files, silently leaving slots empty.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- Length cannot be null when latentType is Hunyuan
- Prompt extensions not installed
- No ImageSource
- Model not selected
- No VAE Selected
AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12).
Data as JSON: /api/errors/d7e87f87c34adc20.
Report an issue: GitHub.
Appendix: source
Thrown at StabilityMatrix.Avalonia/ViewModels/Inference/ModelCardViewModel.cs:1933
Type = clipType,
}
)
.Output
: e
.Nodes.AddTypedNode(
new ComfyNodeBuilder.CLIPLoader
{
Name = e.Nodes.GetUniqueName(nameof(ComfyNodeBuilder.CLIPLoader)),
ClipName = clipName1,
Type = clipType,
}
)
.Output;
}
else
{
// No valid encoders configured
throw new ValidationException(
"No text encoders configured. Please select at least one encoder model."
);
}
}
private static bool AnyClipIsGguf(params HybridModelFile?[] clips) =>
clips.Any(clip => clip is { IsGguf: true });
internal class ModelCardModel
{
public string? SelectedModelName { get; init; }
public string? SelectedRefinerName { get; init; }
public string? SelectedVaeName { get; init; }
// Legacy encoder fields (for backward compatibility)
public string? SelectedClip1Name { get; init; }
public string? SelectedClip2Name { get; init; }
public string? SelectedClip3Name { get; init; }View on GitHub (pinned to af93d6ef57)