{"record":{"id":"89ccad5c2d6bc928","repo":"LykosAI/StabilityMatrix","slug":"scheduler-not-selected-wansamplercardviewmodel","errorCode":null,"errorMessage":"Scheduler not selected","messagePattern":"Scheduler not selected","errorType":"validation","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Avalonia/ViewModels/Inference/WanSamplerCardViewModel.cs","lineNumber":51,"sourceCode":"        SelectedScheduler = ComfyScheduler.Simple;\n        Length = 33;\n    }\n\n    public override void ApplyStep(ModuleApplyStepEventArgs e)\n    {\n        if (EnableAddons)\n        {\n            foreach (var module in ModulesCardViewModel.Cards.OfType<ModuleBase>())\n            {\n                module.ApplyStep(e);\n            }\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        e.Temp = e.CreateTempFromBuilder();\n\n        var conditioning = e.Temp.Base.Conditioning.Unwrap();\n\n        var isImgToVid = IsDenoiseStrengthEnabled;\n\n        if (isImgToVid)\n        {\n            var clipVisionEncode = e.Nodes.AddTypedNode(\n                new ComfyNodeBuilder.CLIPVisionEncode\n                {","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Avalonia/ViewModels/Inference/WanSamplerCardViewModel.cs#L33-L69","documentation":"WanSamplerCardViewModel.ApplyStep() reads SelectedScheduler (nullable ComfyScheduler?) and assigns it as the workflow's PrimaryScheduler. When no scheduler is selected it throws a ValidationException(\"Scheduler not selected\") to abort building the ComfyUI graph. This is the scheduler counterpart of the 'Sampler not selected' check on the same card.","triggerScenarios":"Running a Wan workflow when SelectedScheduler is null at ApplyStep time — the scheduler dropdown was never populated (ComfyUI disconnected / scheduler list not loaded), the selection was cleared, or the card was constructed manually without setting SelectedScheduler.","commonSituations":"ComfyUI backend not connected so schedulers never load; a restored prompt/layout carries a scheduler value that no longer resolves, leaving null; unit tests or other code paths instantiating WanSamplerCardViewModel via DI and invoking ApplyStep directly; binding failure between the scheduler combo box and the view model.","solutions":["Connect to ComfyUI so the scheduler list loads, then select a scheduler in the Wan sampler card before generating.","Restart the Inference tab or the app — the constructor defaults SelectedScheduler to ComfyScheduler.Simple, so a fresh card resolves the null.","If instantiating the card in code/tests, set SelectedScheduler explicitly (e.g. card.SelectedScheduler = ComfyScheduler.Simple) before ApplyStep.","Verify the scheduler dropdown's ItemsSource binding is populated from the client manager's scheduler list."],"exampleFix":"// before (throws)\nvar primaryScheduler = SelectedScheduler ?? throw new ValidationException(\"Scheduler not selected\");\n// after (defensive default)\nvar primaryScheduler = SelectedScheduler ?? ComfyScheduler.Simple;","handlingStrategy":"validation","validationCode":"if (card.SelectedScheduler is null)\n    throw new ValidationException(\"Select a scheduler before generating.\");\ncard.ApplyStep(e);","typeGuard":"bool HasScheduler(WanSamplerCardViewModel c) => c.SelectedScheduler is not null;","tryCatchPattern":"try { card.ApplyStep(e); }\ncatch (ValidationException ex) { NotifyUser(ex.Message); }","preventionTips":["Rely on the constructor default (SelectedScheduler = ComfyScheduler.Simple); avoid clearing it.","Ensure ComfyUI is connected before opening the Inference tab so the scheduler list loads.","Validate all Wan card selections (sampler, scheduler) on Generate before building nodes.","In code/tests, always set SelectedScheduler when constructing the card."],"tags":["csharp","avalonia","inference","validation","comfyui"],"backgroundTag":"missing-required-argument","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"}