{"record":{"id":"4cc063e1ee711d34","repo":"LykosAI/StabilityMatrix","slug":"no-clip2-selected-unetmodelcardviewmodel","errorCode":null,"errorMessage":"No Clip2 Selected","messagePattern":"No Clip2 Selected","errorType":"validation","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Avalonia/ViewModels/Inference/UnetModelCardViewModel.cs","lineNumber":77,"sourceCode":"    }\n\n    public void ApplyStep(ModuleApplyStepEventArgs e)\n    {\n        var checkpointLoader = e.Nodes.AddTypedNode(GetModelLoader(e, SelectedModel!, SelectedDType));\n        e.Builder.Connections.Base.Model = checkpointLoader.Output;\n\n        var vaeLoader = e.Nodes.AddTypedNode(\n            new ComfyNodeBuilder.VAELoader\n            {\n                Name = e.Nodes.GetUniqueName(nameof(ComfyNodeBuilder.VAELoader)),\n                VaeName = SelectedVae?.RelativePath ?? throw new ValidationException(\"No VAE Selected\"),\n            }\n        );\n        e.Builder.Connections.Base.VAE = vaeLoader.Output;\n\n        // DualCLIPLoader (GGUF variant can also load .safetensors, so any gguf pick routes there)\n        var clipName1 = SelectedClip1?.RelativePath ?? throw new ValidationException(\"No Clip1 Selected\");\n        var clipName2 = SelectedClip2?.RelativePath ?? throw new ValidationException(\"No Clip2 Selected\");\n\n        e.Builder.Connections.Base.Clip =\n            SelectedClip1 is { IsGguf: true } || SelectedClip2 is { IsGguf: true }\n                ? e\n                    .Nodes.AddTypedNode(\n                        new ComfyNodeBuilder.DualCLIPLoaderGGUF\n                        {\n                            Name = e.Nodes.GetUniqueName(nameof(ComfyNodeBuilder.DualCLIPLoaderGGUF)),\n                            ClipName1 = clipName1,\n                            ClipName2 = clipName2,\n                            Type = \"flux\",\n                        }\n                    )\n                    .Output\n                : e\n                    .Nodes.AddTypedNode(\n                        new ComfyNodeBuilder.DualCLIPLoader\n                        {","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Avalonia/ViewModels/Inference/UnetModelCardViewModel.cs#L59-L95","documentation":"Thrown in UnetModelCardViewModel.ApplyStep when the second CLIP model is not selected. Dual-CLIP architectures (SDXL, Flux) require exactly two text encoders; with SelectedClip2 null the DualCLIPLoader cannot be configured and validation fails.","triggerScenarios":"ApplyStep executed with SelectedClip2 == null when clipName2 is computed via SelectedClip2?.RelativePath ?? throw.","commonSituations":"User selected Clip1 but left Clip2 unset (only one text encoder downloaded); switching between model families left the second dropdown empty; preset references a removed Clip2 file.","solutions":["Select the second CLIP file (e.g. clip_g.safetensors or t5xxl) in the Clip2 dropdown","Download the missing second text encoder via Model Manager","Fix the preset so both Clip1 and Clip2 point to installed files"],"exampleFix":"// before\nawait vm.ApplyStep(args); // SelectedClip2 null -> throws\n// after\nif (vm.SelectedClip2 is null) { throw new ValidationException(\"Select Clip2 (e.g. clip_g) first\"); }\nawait vm.ApplyStep(args);","handlingStrategy":"validation","validationCode":"if (vm.SelectedClip2 is null)\n    throw new ValidationException(\"Select Clip2 (e.g. clip_g or t5xxl) before generating\");","typeGuard":"bool hasBothClips = vm.SelectedClip1 is not null && vm.SelectedClip2 is not null;","tryCatchPattern":"try { vm.ApplyStep(args); }\ncatch (ValidationException ex) when (ex.Message == \"No Clip2 Selected\") { /* prompt second CLIP selection */ }","preventionTips":["Remember dual-CLIP models need two encoder files","Verify model-family switches reset both CLIP dropdowns","Validate both CLIP paths exist on disk before generation"],"tags":["validation","clip","text-encoder","model-selection"],"backgroundTag":"missing-required-config-field","analyzedSha":"af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002","analyzedAt":"2026-09-12T19:02:43.389Z","contentChangedAt":"2026-09-12T19:02:43.389Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}