LykosAI/StabilityMatrix · error · ValidationException

Scheduler not selected

Error message

Scheduler not selected

What it means

SamplerCardViewModel.ApplyStepsInitialCustomSampler throws this ValidationException when SelectedScheduler is null: after validating the sampler, the method must also set Connections.PrimaryScheduler, and a missing scheduler (e.g. karras, normal, sgm_uniform) leaves the sampler step incomplete, so it fails fast.

Solutions

  1. Select a scheduler in the sampler card's scheduler dropdown before generating.
  2. Programmatically set vm.SelectedScheduler to a valid ComfyScheduler value.
  3. Set both sampler and scheduler together when configuring the card to avoid partial configuration.
  4. Pre-validate both fields before invoking ApplyStepsInitialCustomSampler.

Example fix

// before
samplerCard.SelectedSampler = ComfySampler.Dpmpp2m; // scheduler null
await samplerCard.ApplyStepsInitialCustomSampler(args); // throws
// after
samplerCard.SelectedSampler = ComfySampler.Dpmpp2m;
samplerCard.SelectedScheduler = ComfyScheduler.Karras;
await samplerCard.ApplyStepsInitialCustomSampler(args);
Defensive patterns

Strategy: validation

Validate before calling

if (samplerCard.SelectedSampler is null || samplerCard.SelectedScheduler is null)
    throw new InvalidOperationException("Sampler and scheduler must both be selected");

Type guard

var samplerStepReady = samplerCard.SelectedSampler is not null && samplerCard.SelectedScheduler is not null;

Try / catch

try { await samplerCard.ApplyStepsInitialCustomSampler(args); }
catch (ValidationException ex) when (ex.Message == "Scheduler not selected")
{
    // prompt user to choose a scheduler
}

Prevention

When it happens

Trigger: Calling ApplyStepsInitialCustomSampler with SelectedSampler set but SelectedScheduler never assigned — the scheduler dropdown on the sampler card is empty.

Common situations: User picks a sampler but leaves scheduler at null; scheduler defaults were reset or a settings import omitted the scheduler; programmatic construction sets only SelectedSampler.

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

Appendix: source

Thrown at StabilityMatrix.Avalonia/ViewModels/Inference/SamplerCardViewModel.cs:353

    )
    {
        // Provide temp values
        e.Temp = e.CreateTempFromBuilder();

        // Apply steps from our addons
        ApplyAddonSteps(e);

        // Get primary as latent using vae
        var primaryLatent = e.Builder.GetPrimaryAsLatent(
            e.Temp.Primary!.Unwrap(),
            e.Builder.Connections.GetDefaultVAE()
        );

        // Set primary sampler and scheduler
        var primarySampler = SelectedSampler ?? throw new ValidationException("Sampler not selected");
        e.Builder.Connections.PrimarySampler = primarySampler;

        var primaryScheduler = SelectedScheduler ?? throw new ValidationException("Scheduler not selected");
        e.Builder.Connections.PrimaryScheduler = primaryScheduler;

        // for later inheritance if needed
        e.Builder.Connections.PrimaryCfg = CfgScale;
        e.Builder.Connections.PrimarySteps = Steps;
        e.Builder.Connections.PrimaryModelType = SelectedModelType;

        // KSamplerSelect
        var kSamplerSelect = e.Nodes.AddTypedNode(
            new ComfyNodeBuilder.KSamplerSelect
            {
                Name = e.Nodes.GetUniqueName(nameof(ComfyNodeBuilder.KSamplerSelect)),
                SamplerName = e.Builder.Connections.PrimarySampler?.Name!,
            }
        );

        e.Builder.Connections.PrimarySamplerNode = kSamplerSelect.Output;

View on GitHub (pinned to af93d6ef57)