{"record":{"id":"3fced02ee0f15f0d","repo":"LykosAI/StabilityMatrix","slug":"no-clip4-selected","errorCode":null,"errorMessage":"No Clip4 Selected","messagePattern":"No Clip4 Selected","errorType":"validation","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Avalonia/ViewModels/Inference/ModelCardViewModel.cs","lineNumber":1806,"sourceCode":"            e.Builder.Connections.PrimaryVAE = vaeLoader.Output;\n        }\n    }\n\n    private void SetupClipLoaders(ModuleApplyStepEventArgs e)\n    {\n        // The GGUF loader variants can also load .safetensors encoders, so any gguf pick\n        // routes the whole (possibly mixed) selection through the GGUF loader\n        if (\n            SelectedClip4 is { IsNone: false }\n            && SelectedClip3 is { IsNone: false }\n            && SelectedClip2 is { IsNone: false }\n            && SelectedClip1 is { IsNone: false }\n        )\n        {\n            var clipName1 = SelectedClip1?.RelativePath ?? throw new ValidationException(\"No Clip1 Selected\");\n            var clipName2 = SelectedClip2?.RelativePath ?? throw new ValidationException(\"No Clip2 Selected\");\n            var clipName3 = SelectedClip3?.RelativePath ?? throw new ValidationException(\"No Clip3 Selected\");\n            var clipName4 = SelectedClip4?.RelativePath ?? throw new ValidationException(\"No Clip4 Selected\");\n\n            e.Builder.Connections.Base.Clip = AnyClipIsGguf(\n                SelectedClip1,\n                SelectedClip2,\n                SelectedClip3,\n                SelectedClip4\n            )\n                ? e\n                    .Nodes.AddTypedNode(\n                        new ComfyNodeBuilder.QuadrupleCLIPLoaderGGUF\n                        {\n                            Name = e.Nodes.GetUniqueName(nameof(ComfyNodeBuilder.QuadrupleCLIPLoaderGGUF)),\n                            ClipName1 = clipName1,\n                            ClipName2 = clipName2,\n                            ClipName3 = clipName3,\n                            ClipName4 = clipName4,\n                        }\n                    )","sourceCodeStart":1788,"sourceCodeEnd":1824,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Avalonia/ViewModels/Inference/ModelCardViewModel.cs#L1788-L1824","documentation":"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.","triggerScenarios":"Invoking the builder with Clip1-3 selected but Clip4 null; SelectedClip4 reassigned to null concurrently between the `is { IsNone: false }` guard and node construction.","commonSituations":"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.","solutions":["Select a CLIP model in slot 4 (non-None) before running the workflow","If the model only needs 3 CLIPs, ensure the branch logic routes to the 3-CLIP path instead of the 4-CLIP path","Capture SelectedClip4 into a local prior to the guard to avoid mid-branch nulls","Add aggregate validation of all four slots before entering the builder branch"],"exampleFix":"// before\nvar clipName4 = SelectedClip4?.RelativePath ?? throw new ValidationException(\"No Clip4 Selected\");\n// after\nif (SelectedClip4 is not { IsNone: false } clip4)\n    throw new ValidationException(\"Clip4 required: this checkpoint uses four text encoders\");\nvar clipName4 = clip4.RelativePath;","handlingStrategy":"validation","validationCode":"if (SelectedClip4 is null or { IsNone: true })\n    throw new ValidationException(\"Clip4 must be selected for this checkpoint\");","typeGuard":"static bool HasClip(LazyFileReference? clip) => clip is { IsNone: false };","tryCatchPattern":"try\n{\n    await viewModel.BuildWorkspaceAsync(e);\n}\ncatch (ValidationException ex) when (ex.Message.Contains(\"Clip4\"))\n{\n    NotificationService.ShowPersistent(\"Missing CLIP 4\", ex.Message, NotificationType.Error);\n}","preventionTips":["Confirm whether the model needs 3 or 4 encoders and populate accordingly","Never leave the last slot empty assuming it is optional","Add a pre-build checklist validating Clip1-Clip4"],"tags":["validation","workflow","comfyui","ui-state"],"backgroundTag":"missing-required-argument","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"}