{"record":{"id":"3058817a83291133","repo":"LykosAI/StabilityMatrix","slug":"refiner-model-enabled-but-not-selected","errorCode":null,"errorMessage":"Refiner Model enabled but not selected","messagePattern":"Refiner Model enabled but not selected","errorType":"validation","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Avalonia/ViewModels/Inference/ModelCardViewModel.cs","lineNumber":1766,"sourceCode":"        // always bundle their own text encoder, so falling back to it beats failing validation\n        // for encoder slots the checkpoint UI doesn't even show.\n        if (IsClipModelSelectionEnabled && TextEncoders.Any(slot => slot.SelectedModel is { IsNone: false }))\n        {\n            SetupClipLoaders(e);\n        }\n        else\n        {\n            e.Builder.Connections.Base.Clip = baseLoader.Output2;\n        }\n\n        // Load refiner if enabled\n        if (IsRefinerSelectionEnabled && SelectedRefiner is { IsNone: false })\n        {\n            var refinerLoader = e.Nodes.AddTypedNode(\n                GetDefaultModelLoader(\n                    e,\n                    \"CheckpointLoader_Refiner\",\n                    SelectedRefiner ?? throw new ValidationException(\"Refiner Model enabled but not selected\")\n                )\n            );\n\n            e.Builder.Connections.Refiner.Model = refinerLoader.Output1;\n            e.Builder.Connections.Refiner.Clip = refinerLoader.Output2;\n            e.Builder.Connections.Refiner.VAE = refinerLoader.Output3;\n        }\n\n        // Load VAE override if enabled\n        if (IsVaeSelectionEnabled && SelectedVae is { IsNone: false, IsDefault: false })\n        {\n            var vaeLoader = e.Nodes.AddTypedNode(\n                new ComfyNodeBuilder.VAELoader\n                {\n                    Name = \"VAELoader\",\n                    VaeName =\n                        SelectedVae?.RelativePath\n                        ?? throw new ValidationException(\"VAE enabled but not selected\"),","sourceCodeStart":1748,"sourceCodeEnd":1784,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Avalonia/ViewModels/Inference/ModelCardViewModel.cs#L1748-L1784","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Select a refiner checkpoint in the Model card's refiner slot","Disable the refiner toggle if you don't want a second model — the check only runs when IsRefinerSelectionEnabled is true","Re-download/re-select the refiner model if its file no longer resolves in the Model Manager"],"exampleFix":"// before\nSelectedRefiner ?? throw new ValidationException(\"Refiner Model enabled but not selected\")\n// after\nif (SelectedRefiner is null)\n{\n    NotificationHelper.Warn(\"Enable refiner requires selecting a refiner model\");\n    return;\n}\nvar refinerLoader = e.Nodes.AddTypedNode(GetDefaultModelLoader(e, \"CheckpointLoader_Refiner\", SelectedRefiner));","handlingStrategy":"validation","validationCode":"if (vm.IsRefinerSelectionEnabled && (vm.SelectedRefiner is null || vm.SelectedRefiner.IsNone))\n    throw new InvalidOperationException(\"Refiner enabled but no refiner model selected\");","typeGuard":"bool RefinerReady(ModelCardViewModel vm) => !vm.IsRefinerSelectionEnabled || vm.SelectedRefiner is { IsNone: false, RelativePath.Length: > 0 };","tryCatchPattern":"try { builder.ApplyStep(e); } catch (ValidationException ex) when (ex.Message.Contains(\"Refiner Model\")) { NotifyUser(\"Pick a refiner model or disable the refiner\"); }","preventionTips":["Disable the refiner toggle when no second model is wanted","Pair the enable-toggle UI with a required-field validator","Re-select the refiner after model file moves or deletions"],"tags":["validation","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"}