{"record":{"id":"f340acaef76c113a","repo":"LykosAI/StabilityMatrix","slug":"title-model-not-selected","errorCode":null,"errorMessage":"{Title}: Model not selected","messagePattern":"(.+?): Model not selected","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Avalonia/ViewModels/Inference/Modules/PromptExpansionModule.cs","lineNumber":28,"sourceCode":"\n[ManagedService]\n[RegisterTransient<PromptExpansionModule>]\npublic class PromptExpansionModule : ModuleBase\n{\n    public PromptExpansionModule(IServiceManager<ViewModelBase> vmFactory)\n        : base(vmFactory)\n    {\n        Title = \"Prompt Expansion\";\n        AddCards(vmFactory.Get<PromptExpansionCardViewModel>());\n    }\n\n    protected override void OnApplyStep(ModuleApplyStepEventArgs e)\n    {\n        var promptExpansionCard = GetCard<PromptExpansionCardViewModel>();\n\n        var model =\n            promptExpansionCard.SelectedModel\n            ?? throw new InvalidOperationException($\"{Title}: Model not selected\");\n\n        e.Builder.Connections.PositivePrompt = e.Nodes.AddTypedNode(\n            new ComfyNodeBuilder.PromptExpansion\n            {\n                Name = e.Nodes.GetUniqueName(\"PromptExpansion_Positive\"),\n                ModelName = model.RelativePath,\n                Text = e.Builder.Connections.PositivePrompt,\n                Seed = e.Builder.Connections.Seed,\n                LogPrompt = promptExpansionCard.IsLogOutputEnabled\n            }\n        ).Output;\n    }\n}\n","sourceCodeStart":10,"sourceCodeEnd":42,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Avalonia/ViewModels/Inference/Modules/PromptExpansionModule.cs#L10-L42","documentation":"PromptExpansionModule.OnApplyStep() retrieves the PromptExpansionCardViewModel and reads its SelectedModel to build a ComfyNodeBuilder.PromptExpansion node. Because no prompt-expansion model is chosen, the module throws InvalidOperationException (\"{Title}: Model not selected\") to stop workflow generation rather than emitting a node with a null ModelName. Title is the module's display title, so the message identifies which Prompt Expansion card is misconfigured.","triggerScenarios":"Clicking Generate with the Prompt Expansion module enabled but no model selected in its dropdown — either the user never picked a model, the model list is empty (no compatible models installed/indexed), or the previously selected model was uninstalled so SelectedModel reverted to null.","commonSituations":"Fresh install of Stability Matrix where no prompt-expansion model (e.g. a T5/CLIP-based expansion checkpoint) has been downloaded; the model file was moved or deleted from the models directory so it disappears from the picker; shared ComfyUI folder not configured so installed models aren't discovered; enabling the module via layout import without its model selection.","solutions":["Open the Prompt Expansion card in the Inference tab and select a model from the dropdown before generating.","If the dropdown is empty, download/install a compatible model via the Model Browser and verify the models directory (or shared ComfyUI folder) is configured in settings.","Refresh the model list / restart the app so the installed model is indexed and appears in the picker.","If building the module in code, set the card's SelectedModel before calling ApplyStep, or disable the Prompt Expansion module if not needed."],"exampleFix":"// before\nvar model = promptExpansionCard.SelectedModel\n    ?? throw new InvalidOperationException($\"{Title}: Model not selected\");\n// after (caller-side guard)\nif (promptExpansionCard.SelectedModel is null)\n    return; // or show a validation message instead of throwing mid-pipeline","handlingStrategy":"validation","validationCode":"if (module is PromptExpansionModule pe &&\n    pe.GetCard<PromptExpansionCardViewModel>().SelectedModel is null)\n{\n    // disable module or prompt the user to pick a model before generating\n}","typeGuard":"bool HasExpansionModel(PromptExpansionCardViewModel c) => c.SelectedModel is not null;","tryCatchPattern":"try { module.ApplyStep(e); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"Model not selected\"))\n{ ShowModelPickerDialog(); }","preventionTips":["Install at least one compatible prompt-expansion model and verify it appears in the card dropdown.","Keep the shared ComfyUI models directory configured so installed models are always discovered.","Disable the Prompt Expansion module when no model is available instead of leaving it enabled.","Re-check SelectedModel after model uninstall/moves; refresh the model list before generating."],"tags":["csharp","avalonia","inference","comfyui","model-selection"],"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"}