{"record":{"id":"472a404e703b4236","repo":"LykosAI/StabilityMatrix","slug":"no-selectedmodel","errorCode":null,"errorMessage":"No SelectedModel","messagePattern":"No SelectedModel","errorType":"validation","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Avalonia/ViewModels/Inference/Modules/ControlNetModule.cs","lineNumber":155,"sourceCode":"            }\n            e.Temp.Primary = controlNetReferenceOnly.Output2;\n\n            // Indicate that the Primary latent has been temp batched\n            // https://github.com/comfyanonymous/ComfyUI_experiments/issues/11\n\n            e.Temp.IsPrimaryTempBatched = true;\n            // Index 0 is the original image, index 1 is the reference only latent\n            e.Temp.PrimaryTempBatchPickIndex = 1;\n\n            return;\n        }\n\n        var controlNetLoader = e.Nodes.AddTypedNode(\n            new ComfyNodeBuilder.ControlNetLoader\n            {\n                Name = e.Nodes.GetUniqueName(\"ControlNetLoader\"),\n                ControlNetName =\n                    card.SelectedModel?.RelativePath ?? throw new ValidationException(\"No SelectedModel\"),\n            }\n        );\n\n        var controlNetApply = e.Nodes.AddTypedNode(\n            new ComfyNodeBuilder.ControlNetApplyAdvanced\n            {\n                Name = e.Nodes.GetUniqueName(\"ControlNetApply\"),\n                Image = image,\n                ControlNet = controlNetLoader.Output,\n                Positive = e.Temp.Base.Conditioning!.Unwrap().Positive,\n                Negative = e.Temp.Base.Conditioning.Negative,\n                Strength = card.Strength,\n                StartPercent = card.StartPercent,\n                EndPercent = card.EndPercent,\n            }\n        );\n\n        e.Temp.Base.Conditioning = (controlNetApply.Output1, controlNetApply.Output2);","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Avalonia/ViewModels/Inference/Modules/ControlNetModule.cs#L137-L173","documentation":"ControlNetModule.OnApplyStep throws this ValidationException when constructing the ComfyNodeBuilder.ControlNetLoader node: card.SelectedModel is null, so there is no ControlNet model relative path to load. The module cannot wire a ControlNetApplyAdvanced node without a model, so it fails fast before emitting the graph.","triggerScenarios":"Including a ControlNet module in the pipeline while the ControlNet card's model dropdown (SelectedModel) is unset or holds no installed ControlNet model.","commonSituations":"User enables the ControlNet toggle and selects an image but never picks a ControlNet model; the selected model file was deleted/moved so the card's selection reset to null; programmatically constructed module wired with only an image and preprocessor.","solutions":["Pick a ControlNet model in the ControlNet card's model selector before generating.","Install/import a matching ControlNet model (e.g. matching the base model and preprocessor type) and select it.","Programmatically set card.SelectedModel to a valid HybridModelFile whose RelativePath exists under the ControlNet models folder.","Disable the ControlNet module if it is not needed.","Verify the model file still exists on disk, since a missing file can clear the selection."],"exampleFix":"// before\ncontrolNetCard.SelectImageCardViewModel.ImageSource = img; // model unset\nawait vm.Generate();\n// after\ncontrolNetCard.SelectImageCardViewModel.ImageSource = img;\ncontrolNetCard.SelectedModel = controlNetModelFile;\nawait vm.Generate();","handlingStrategy":"validation","validationCode":"if (controlNetCard.SelectedModel is null)\n    throw new InvalidOperationException(\"ControlNet requires a model selection\");","typeGuard":"var hasControlNetModel = controlNetCard.SelectedModel?.RelativePath is not null;","tryCatchPattern":"try { await vm.Generate(); }\ncatch (ValidationException ex) when (ex.Message == \"No SelectedModel\")\n{\n    // prompt user to pick a ControlNet model\n}","preventionTips":["Validate image + model + preprocessor together when enabling a ControlNet card.","Verify the selected model file still exists on disk before generation.","Auto-select a compatible ControlNet model when the base model type is known."],"tags":["validation","comfyui","controlnet","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"}