LykosAI/StabilityMatrix · error · ValidationException

No Clip4 Selected

Error message

No Clip4 Selected

What it means

ValidationException thrown for the fourth CLIP slot in the 4-CLIP branch of ModelCardViewModel's workflow builder. `SelectedClip4?.RelativePath ?? throw` fires when SelectedClip4 is null while constructing the QuadCLIPLoaderGGUF node, i.e. the last text-encoder slot was never populated.

Solutions

  1. Select a CLIP model in slot 4 (non-None) before running the workflow
  2. If the model only needs 3 CLIPs, ensure the branch logic routes to the 3-CLIP path instead of the 4-CLIP path
  3. Capture SelectedClip4 into a local prior to the guard to avoid mid-branch nulls
  4. Add aggregate validation of all four slots before entering the builder branch

Example fix

// before
var clipName4 = SelectedClip4?.RelativePath ?? throw new ValidationException("No Clip4 Selected");
// after
if (SelectedClip4 is not { IsNone: false } clip4)
    throw new ValidationException("Clip4 required: this checkpoint uses four text encoders");
var clipName4 = clip4.RelativePath;
Defensive patterns

Strategy: validation

Validate before calling

if (SelectedClip4 is null or { IsNone: true })
    throw new ValidationException("Clip4 must be selected for this checkpoint");

Type guard

static bool HasClip(LazyFileReference? clip) => clip is { IsNone: false };

Try / catch

try
{
    await viewModel.BuildWorkspaceAsync(e);
}
catch (ValidationException ex) when (ex.Message.Contains("Clip4"))
{
    NotificationService.ShowPersistent("Missing CLIP 4", ex.Message, NotificationType.Error);
}

Prevention

When it happens

Trigger: Invoking the builder with Clip1-3 selected but Clip4 null; SelectedClip4 reassigned to null concurrently between the `is { IsNone: false }` guard and node construction.

Common situations: Models like some Hunyuan Video or multi-encoder setups needing four CLIPs where users stop after three; a slot reset by the UI when switching checkpoints; forgetting that the 4-CLIP branch requires every slot.

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/3fced02ee0f15f0d. Report an issue: GitHub.

Appendix: source

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

            e.Builder.Connections.PrimaryVAE = vaeLoader.Output;
        }
    }

    private void SetupClipLoaders(ModuleApplyStepEventArgs e)
    {
        // The GGUF loader variants can also load .safetensors encoders, so any gguf pick
        // routes the whole (possibly mixed) selection through the GGUF loader
        if (
            SelectedClip4 is { IsNone: false }
            && SelectedClip3 is { IsNone: false }
            && SelectedClip2 is { IsNone: false }
            && SelectedClip1 is { IsNone: false }
        )
        {
            var clipName1 = SelectedClip1?.RelativePath ?? throw new ValidationException("No Clip1 Selected");
            var clipName2 = SelectedClip2?.RelativePath ?? throw new ValidationException("No Clip2 Selected");
            var clipName3 = SelectedClip3?.RelativePath ?? throw new ValidationException("No Clip3 Selected");
            var clipName4 = SelectedClip4?.RelativePath ?? throw new ValidationException("No Clip4 Selected");

            e.Builder.Connections.Base.Clip = AnyClipIsGguf(
                SelectedClip1,
                SelectedClip2,
                SelectedClip3,
                SelectedClip4
            )
                ? e
                    .Nodes.AddTypedNode(
                        new ComfyNodeBuilder.QuadrupleCLIPLoaderGGUF
                        {
                            Name = e.Nodes.GetUniqueName(nameof(ComfyNodeBuilder.QuadrupleCLIPLoaderGGUF)),
                            ClipName1 = clipName1,
                            ClipName2 = clipName2,
                            ClipName3 = clipName3,
                            ClipName4 = clipName4,
                        }
                    )

View on GitHub (pinned to af93d6ef57)