{"record":{"id":"1c68c92c29a1514a","repo":"LykosAI/StabilityMatrix","slug":"upscaler-is-required","errorCode":null,"errorMessage":"Upscaler is required","messagePattern":"Upscaler is required","errorType":"validation","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Avalonia/ViewModels/Inference/Modules/UpscalerModule.cs","lineNumber":41,"sourceCode":"\n    /// <inheritdoc />\n    protected override void OnApplyStep(ModuleApplyStepEventArgs e)\n    {\n        var card = GetCard<UpscalerCardViewModel>();\n\n        // Skip if scale is close to 1\n        if (Math.Abs(card.Scale - 1) < 0.005)\n        {\n            return;\n        }\n\n        var upscaleSize = e.Builder.Connections.PrimarySize.WithScale(card.Scale);\n\n        var upscaleResult = e.Builder.Group_Upscale(\n            e.Builder.Nodes.GetUniqueName(\"PostUpscale\"),\n            e.Builder.Connections.Primary ?? throw new ArgumentException(\"No Primary\"),\n            e.Builder.Connections.GetDefaultVAE(),\n            card.SelectedUpscaler ?? throw new ValidationException(\"Upscaler is required\"),\n            upscaleSize.Width,\n            upscaleSize.Height\n        );\n\n        e.Builder.Connections.Primary = upscaleResult;\n        e.Builder.Connections.PrimarySize = upscaleSize;\n    }\n}\n","sourceCodeStart":23,"sourceCodeEnd":50,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Avalonia/ViewModels/Inference/Modules/UpscalerModule.cs#L23-L50","documentation":"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.","triggerScenarios":"Adding/upscaling in the inference pipeline with the Upscaler card enabled but its upscaler model dropdown left empty at generation time.","commonSituations":"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.","solutions":["Select an upscaler model in the Upscaler card's model dropdown before generating.","Install an upscaler model (e.g. 4x-UltraSharp.pth) into the upscale models directory so it can be selected.","Programmatically set card.SelectedUpscaler to a valid installed HybridModelFile.","Remove/disable the Upscaler step if upscaling is not needed.","Pre-validate that SelectedUpscaler is non-null whenever the upscaler card is enabled."],"exampleFix":"// before\nupscalerCard.IsEnabled = true; // SelectedUpscaler null\nawait vm.Generate();\n// after\nupscalerCard.IsEnabled = true;\nupscalerCard.SelectedUpscaler = upscalerModelFile;\nawait vm.Generate();","handlingStrategy":"validation","validationCode":"if (upscalerCard.SelectedUpscaler is null)\n    throw new InvalidOperationException(\"Upscaler step requires an upscaler model\");","typeGuard":"var hasUpscaler = upscalerCard.SelectedUpscaler?.RelativePath is not null;","tryCatchPattern":"try { await vm.Generate(); }\ncatch (ValidationException ex) when (ex.Message == \"Upscaler is required\")\n{\n    // prompt user to pick an upscaler model\n}","preventionTips":["Gate the upscale step behind a non-null SelectedUpscaler check.","Ship/point users to install a default upscaler model so the dropdown is never empty.","Clear or disable the upscale step if its model file is deleted."],"tags":["validation","comfyui","upscaler","missing-model"],"backgroundTag":"missing-required-option","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"}