LykosAI/StabilityMatrix · error · ValidationException

VAE enabled but not selected

Error message

VAE enabled but not selected

What it means

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.

Solutions

  1. Select a VAE file in the Model card's VAE dropdown
  2. Turn off the VAE override option to fall back to the checkpoint's built-in VAE if you don't need a separate one
  3. Restore or re-select the VAE file if it was moved or deleted

Example fix

// before
VaeName = SelectedVae?.RelativePath ?? throw new ValidationException("VAE enabled but not selected")
// after
if (SelectedVae is null)
{
    NotificationHelper.Warn("VAE override is enabled — select a VAE");
    return;
}
VaeName = SelectedVae.RelativePath
Defensive patterns

Strategy: validation

Validate before calling

if (vm.IsVaeSelectionEnabled && (vm.SelectedVae is null || string.IsNullOrEmpty(vm.SelectedVae.RelativePath)))
    throw new InvalidOperationException("VAE override enabled but no VAE selected");

Type guard

bool VaeOverrideReady(ModelCardViewModel vm) => !vm.IsVaeSelectionEnabled || vm.SelectedVae is { RelativePath.Length: > 0 };

Try / catch

try { builder.ApplyStep(e); } catch (ValidationException ex) when (ex.Message == "VAE enabled but not selected") { NotifyUser("Select a VAE or disable the override"); }

Prevention

When it happens

Trigger: Building a workflow with the "override VAE" option enabled while the VAE dropdown has no selection: SelectedVae is null inside the enabled-VAE branch.

Common situations: 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.

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/8b4f9e01ce803d5e. Report an issue: GitHub.

Appendix: source

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

                    SelectedRefiner ?? throw new ValidationException("Refiner Model enabled but not selected")
                )
            );

            e.Builder.Connections.Refiner.Model = refinerLoader.Output1;
            e.Builder.Connections.Refiner.Clip = refinerLoader.Output2;
            e.Builder.Connections.Refiner.VAE = refinerLoader.Output3;
        }

        // Load VAE override if enabled
        if (IsVaeSelectionEnabled && SelectedVae is { IsNone: false, IsDefault: false })
        {
            var vaeLoader = e.Nodes.AddTypedNode(
                new ComfyNodeBuilder.VAELoader
                {
                    Name = "VAELoader",
                    VaeName =
                        SelectedVae?.RelativePath
                        ?? throw new ValidationException("VAE enabled but not selected"),
                }
            );

            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 }
        )
        {

View on GitHub (pinned to af93d6ef57)