LykosAI/StabilityMatrix · error · ValidationException

Upscaler is required

Error message

Upscaler is required

What it means

UpscalerModule.OnApplyStep throws this ValidationException when calling Group_Upscale because card.SelectedUpscaler is null — no upscale model (e.g. an ESRGAN/4x-UltraSharp upscaler) was chosen on the upscaler card. The upscale group node needs a model name, so the workflow build aborts.

Solutions

  1. Select an upscaler model in the Upscaler card's model dropdown before generating.
  2. Install an upscaler model (e.g. 4x-UltraSharp.pth) into the upscale models directory so it can be selected.
  3. Programmatically set card.SelectedUpscaler to a valid installed HybridModelFile.
  4. Remove/disable the Upscaler step if upscaling is not needed.
  5. Pre-validate that SelectedUpscaler is non-null whenever the upscaler card is enabled.

Example fix

// before
upscalerCard.IsEnabled = true; // SelectedUpscaler null
await vm.Generate();
// after
upscalerCard.IsEnabled = true;
upscalerCard.SelectedUpscaler = upscalerModelFile;
await vm.Generate();
Defensive patterns

Strategy: validation

Validate before calling

if (upscalerCard.SelectedUpscaler is null)
    throw new InvalidOperationException("Upscaler step requires an upscaler model");

Type guard

var hasUpscaler = upscalerCard.SelectedUpscaler?.RelativePath is not null;

Try / catch

try { await vm.Generate(); }
catch (ValidationException ex) when (ex.Message == "Upscaler is required")
{
    // prompt user to pick an upscaler model
}

Prevention

When it happens

Trigger: Adding/upscaling in the inference pipeline with the Upscaler card enabled but its upscaler model dropdown left empty at generation time.

Common situations: User enables upscale step but forgets to pick an upscaler model; upscaler models were never added to the Upscale Models folder so nothing can be selected; imported preset references an upscaler that no longer exists, leaving the selection null.

Understand the failure class

Background: "Must pass :limit option" / "Missing required option" — required option errors explained — this error's family across 41 libraries.

Related errors


AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12). Data as JSON: /api/errors/1c68c92c29a1514a. Report an issue: GitHub.

Appendix: source

Thrown at StabilityMatrix.Avalonia/ViewModels/Inference/Modules/UpscalerModule.cs:41

    /// <inheritdoc />
    protected override void OnApplyStep(ModuleApplyStepEventArgs e)
    {
        var card = GetCard<UpscalerCardViewModel>();

        // Skip if scale is close to 1
        if (Math.Abs(card.Scale - 1) < 0.005)
        {
            return;
        }

        var upscaleSize = e.Builder.Connections.PrimarySize.WithScale(card.Scale);

        var upscaleResult = e.Builder.Group_Upscale(
            e.Builder.Nodes.GetUniqueName("PostUpscale"),
            e.Builder.Connections.Primary ?? throw new ArgumentException("No Primary"),
            e.Builder.Connections.GetDefaultVAE(),
            card.SelectedUpscaler ?? throw new ValidationException("Upscaler is required"),
            upscaleSize.Width,
            upscaleSize.Height
        );

        e.Builder.Connections.Primary = upscaleResult;
        e.Builder.Connections.PrimarySize = upscaleSize;
    }
}

View on GitHub (pinned to af93d6ef57)