{"record":{"id":"8b4f9e01ce803d5e","repo":"LykosAI/StabilityMatrix","slug":"vae-enabled-but-not-selected","errorCode":null,"errorMessage":"VAE enabled but not selected","messagePattern":"VAE enabled but not selected","errorType":"validation","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Avalonia/ViewModels/Inference/ModelCardViewModel.cs","lineNumber":1784,"sourceCode":"                    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\"),\n                }\n            );\n\n            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        {","sourceCodeStart":1766,"sourceCodeEnd":1802,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Avalonia/ViewModels/Inference/ModelCardViewModel.cs#L1766-L1802","documentation":"When the separate-VAE option is enabled, the builder emits a VAELoader named \"VAELoader\" and wires it to Connections.PrimaryVAE; a null SelectedVae yields a null VaeName and this ValidationException is thrown instead of constructing the node.","triggerScenarios":"Building a workflow with the \"override VAE\" option enabled while the VAE dropdown has no selection: SelectedVae is null inside the enabled-VAE branch.","commonSituations":"User enables custom VAE override but forgets to pick a file; VAE deleted/renamed after the option was enabled; imported workflow template with VAE override on and empty selection.","solutions":["Select a VAE file in the Model card's VAE dropdown","Turn off the VAE override option to fall back to the checkpoint's built-in VAE if you don't need a separate one","Restore or re-select the VAE file if it was moved or deleted"],"exampleFix":"// before\nVaeName = SelectedVae?.RelativePath ?? throw new ValidationException(\"VAE enabled but not selected\")\n// after\nif (SelectedVae is null)\n{\n    NotificationHelper.Warn(\"VAE override is enabled — select a VAE\");\n    return;\n}\nVaeName = SelectedVae.RelativePath","handlingStrategy":"validation","validationCode":"if (vm.IsVaeSelectionEnabled && (vm.SelectedVae is null || string.IsNullOrEmpty(vm.SelectedVae.RelativePath)))\n    throw new InvalidOperationException(\"VAE override enabled but no VAE selected\");","typeGuard":"bool VaeOverrideReady(ModelCardViewModel vm) => !vm.IsVaeSelectionEnabled || vm.SelectedVae is { RelativePath.Length: > 0 };","tryCatchPattern":"try { builder.ApplyStep(e); } catch (ValidationException ex) when (ex.Message == \"VAE enabled but not selected\") { NotifyUser(\"Select a VAE or disable the override\"); }","preventionTips":["Enable VAE override only when a VAE file is already picked","Use the checkpoint's built-in VAE unless a custom one is required","Audit imported templates for enabled-but-empty VAE overrides"],"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"}