LykosAI/StabilityMatrix · error · ValidationException

Refiner Model enabled but not selected

Error message

Refiner Model enabled but not selected

What it means

When refiner selection is enabled, the builder wires a refiner checkpoint loader; SelectedRefiner being null (or left as a None placeholder while the IsNone guard is being bypassed by the null case) triggers this ValidationException before the refiner connections are set.

Solutions

  1. Select a refiner checkpoint in the Model card's refiner slot
  2. Disable the refiner toggle if you don't want a second model — the check only runs when IsRefinerSelectionEnabled is true
  3. Re-download/re-select the refiner model if its file no longer resolves in the Model Manager

Example fix

// before
SelectedRefiner ?? throw new ValidationException("Refiner Model enabled but not selected")
// after
if (SelectedRefiner is null)
{
    NotificationHelper.Warn("Enable refiner requires selecting a refiner model");
    return;
}
var refinerLoader = e.Nodes.AddTypedNode(GetDefaultModelLoader(e, "CheckpointLoader_Refiner", SelectedRefiner));
Defensive patterns

Strategy: validation

Validate before calling

if (vm.IsRefinerSelectionEnabled && (vm.SelectedRefiner is null || vm.SelectedRefiner.IsNone))
    throw new InvalidOperationException("Refiner enabled but no refiner model selected");

Type guard

bool RefinerReady(ModelCardViewModel vm) => !vm.IsRefinerSelectionEnabled || vm.SelectedRefiner is { IsNone: false, RelativePath.Length: > 0 };

Try / catch

try { builder.ApplyStep(e); } catch (ValidationException ex) when (ex.Message.Contains("Refiner Model")) { NotifyUser("Pick a refiner model or disable the refiner"); }

Prevention

When it happens

Trigger: Building a refiner workflow with IsRefinerSelectionEnabled == true and SelectedRefiner null: the null-conditional pattern `SelectedRefiner is { IsNone: false }` passes into GetDefaultModelLoader, whose argument throws because SelectedRefiner is null.

Common situations: User toggles "Use refiner" on but never picks a refiner checkpoint; refiner model deleted/renamed after enabling; shared workflow template with refiner enabled but no local refiner model.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at StabilityMatrix.Avalonia/ViewModels/Inference/ModelCardViewModel.cs:1766

        // always bundle their own text encoder, so falling back to it beats failing validation
        // for encoder slots the checkpoint UI doesn't even show.
        if (IsClipModelSelectionEnabled && TextEncoders.Any(slot => slot.SelectedModel is { IsNone: false }))
        {
            SetupClipLoaders(e);
        }
        else
        {
            e.Builder.Connections.Base.Clip = baseLoader.Output2;
        }

        // Load refiner if enabled
        if (IsRefinerSelectionEnabled && SelectedRefiner is { IsNone: false })
        {
            var refinerLoader = e.Nodes.AddTypedNode(
                GetDefaultModelLoader(
                    e,
                    "CheckpointLoader_Refiner",
                    SelectedRefiner ?? throw new ValidationException("Refiner Model enabled but not selected")
                )
            );

            e.Builder.Connections.Refiner.Model = refinerLoader.Output1;
            e.Builder.Connections.Refiner.Clip = refinerLoader.Output2;
            e.Builder.Connections.Refiner.VAE = refinerLoader.Output3;
        }

        // Load VAE override if enabled
        if (IsVaeSelectionEnabled && SelectedVae is { IsNone: false, IsDefault: false })
        {
            var vaeLoader = e.Nodes.AddTypedNode(
                new ComfyNodeBuilder.VAELoader
                {
                    Name = "VAELoader",
                    VaeName =
                        SelectedVae?.RelativePath
                        ?? throw new ValidationException("VAE enabled but not selected"),

View on GitHub (pinned to af93d6ef57)