{"record":{"id":"437d7c0717db8a98","repo":"LykosAI/StabilityMatrix","slug":"sampler-not-selected","errorCode":null,"errorMessage":"Sampler not selected","messagePattern":"Sampler not selected","errorType":"validation","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Avalonia/ViewModels/Inference/SamplerCardViewModel.cs","lineNumber":350,"sourceCode":"        ModuleApplyStepEventArgs e,\n        bool useFluxGuidance,\n        bool useFlux2Scheduler = false\n    )\n    {\n        // Provide temp values\n        e.Temp = e.CreateTempFromBuilder();\n\n        // Apply steps from our addons\n        ApplyAddonSteps(e);\n\n        // Get primary as latent using vae\n        var primaryLatent = e.Builder.GetPrimaryAsLatent(\n            e.Temp.Primary!.Unwrap(),\n            e.Builder.Connections.GetDefaultVAE()\n        );\n\n        // Set primary sampler and scheduler\n        var primarySampler = SelectedSampler ?? throw new ValidationException(\"Sampler not selected\");\n        e.Builder.Connections.PrimarySampler = primarySampler;\n\n        var primaryScheduler = SelectedScheduler ?? throw new ValidationException(\"Scheduler not selected\");\n        e.Builder.Connections.PrimaryScheduler = primaryScheduler;\n\n        // for later inheritance if needed\n        e.Builder.Connections.PrimaryCfg = CfgScale;\n        e.Builder.Connections.PrimarySteps = Steps;\n        e.Builder.Connections.PrimaryModelType = SelectedModelType;\n\n        // KSamplerSelect\n        var kSamplerSelect = e.Nodes.AddTypedNode(\n            new ComfyNodeBuilder.KSamplerSelect\n            {\n                Name = e.Nodes.GetUniqueName(nameof(ComfyNodeBuilder.KSamplerSelect)),\n                SamplerName = e.Builder.Connections.PrimarySampler?.Name!,\n            }\n        );","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Avalonia/ViewModels/Inference/SamplerCardViewModel.cs#L332-L368","documentation":"SamplerCardViewModel.ApplyStepsInitialCustomSampler throws this ValidationException when applying a custom-sampler step: SelectedSampler is null, so Connections.PrimarySampler cannot be set. The initial custom sampler step must define which ComfyUI sampler (e.g. euler, dpmpp_2m) to use, so it fails fast.","triggerScenarios":"Running the workflow build path that calls ApplyStepsInitialCustomSampler with the sampler card's SelectedSampler property never set (no sampler chosen in the sampler card).","commonSituations":"User clears the sampler dropdown in the sampler card; a sampler pack/custom sampler selection failed to load so the default is null; programmatically constructing a SamplerCardViewModel without assigning SelectedSampler.","solutions":["Choose a sampler in the sampler card's sampler dropdown before generating.","Programmatically set vm.SelectedSampler to a valid ComfySampler value.","Restore default sampler settings for the card to repopulate the selection.","Guard generation: if SelectedSampler is null, surface a friendly prompt to pick one instead of letting the build throw."],"exampleFix":"// before\nvar samplerCard = new SamplerCardViewModel();\nawait samplerCard.ApplyStepsInitialCustomSampler(stepArgs); // throws\n// after\nvar samplerCard = new SamplerCardViewModel();\nsamplerCard.SelectedSampler = ComfySampler.EulerAncestral;\nsamplerCard.SelectedScheduler = ComfyScheduler.Karras;\nawait samplerCard.ApplyStepsInitialCustomSampler(stepArgs);","handlingStrategy":"validation","validationCode":"if (samplerCard.SelectedSampler is null)\n    throw new InvalidOperationException(\"Sampler must be selected before generation\");","typeGuard":"var samplerReady = samplerCard.SelectedSampler is ComfySampler;","tryCatchPattern":"try { await samplerCard.ApplyStepsInitialCustomSampler(args); }\ncatch (ValidationException ex) when (ex.Message == \"Sampler not selected\")\n{\n    // prompt user to choose a sampler\n}","preventionTips":["Set a sensible default sampler when creating SamplerCardViewModel instances.","Bind the sampler dropdown with a non-null default so it cannot remain empty.","Validate sampler+scheduler together before invoking any ApplySteps method."],"tags":["validation","comfyui","sampler","missing-selection"],"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"}