{"record":{"id":"c6236ec6d9c8cdcc","repo":"LykosAI/StabilityMatrix","slug":"definition-definition-name-has-definition-options-count","errorCode":null,"errorMessage":"Definition: '{definition.Name}' has {definition.Options.Count} options, it must have exactly 1 option for non-bool types","messagePattern":"Definition: '(.+?)' has (.+?) options, it must have exactly 1 option for non-bool types","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix/ViewModels/LaunchOptionsDialogViewModel.cs","lineNumber":84,"sourceCode":"        foreach (var card in Cards)\n        {\n            launchArgs.AddRange(card.Options);\n        }\n        return launchArgs;\n    }\n\n    public void Initialize(IEnumerable<LaunchOptionDefinition> definitions, IEnumerable<LaunchOption> launchArgs)\n    {\n        Clear();\n        // During card creation, store dict of options with initial values\n        var initialOptions = new Dictionary<string, object>();\n        // Create cards\n        foreach (var definition in definitions)\n        {\n            // Check that non-bool types have exactly one option\n            if (definition.Type != LaunchOptionType.Bool && definition.Options.Count != 1)\n            {\n                throw new InvalidOperationException(\n                    $\"Definition: '{definition.Name}' has {definition.Options.Count} options,\" +\n                    $\" it must have exactly 1 option for non-bool types\");\n            }\n            // Store initial values\n            if (definition.InitialValue != null)\n            {\n                // For bool types, initial value can be string (single/multiple options) or bool (single option)\n                if (definition.Type == LaunchOptionType.Bool)\n                {\n                    // For single option, check bool\n                    if (definition.Options.Count == 1 && definition.InitialValue is bool boolValue)\n                    {\n                        initialOptions[definition.Options.First()] = boolValue;\n                    }\n                    else\n                    {\n                        // For single/multiple options (string only)\n                        var option = definition.Options.FirstOrDefault(opt => opt.Equals(definition.InitialValue));","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix/ViewModels/LaunchOptionsDialogViewModel.cs#L66-L102","documentation":"LaunchOptionsDialogViewModel.Initialize builds cards from launch option definitions and enforces that every non-Bool definition has exactly one Option (a single choice value). Multi-option lists only make sense for Bool flags, so any other shape is treated as a malformed definition and throws immediately at dialog construction.","triggerScenarios":"Opening the launch options dialog while a package's launch option definition (from a package Mod/Config yaml) declares Type String/Multiple/etc. with zero or more than one entry in Options.","commonSituations":"A community package author wrote a launch option with several options for a non-bool type; a package yaml was hand-edited incorrectly; an older package definition predates a schema change and now violates the rule.","solutions":["Fix the package's launch option definition so non-Bool types have exactly one Options entry.","If the type was meant to be a toggle with multiple options, change Type to LaunchOptionType.Bool.","Check for package updates where the author corrected the definition.","Report the malformed definition to the package maintainer if it ships that way."],"exampleFix":"// before\n- name: Mode\n  type: String\n  options: [fast, safe]   # invalid: 2 options on non-bool\n// after\n- name: Mode\n  type: String\n  options: [fast]","handlingStrategy":"validation","validationCode":"foreach (var d in definitions)\n    if (d.Type != LaunchOptionType.Bool && d.Options.Count != 1)\n        throw new InvalidOperationException($\"{d.Name}: non-bool options must have exactly 1 option\");","typeGuard":"static bool IsValidOptionDefinition(LaunchOptionDefinition d) =>\n    d.Type == LaunchOptionType.Bool || d.Options.Count == 1;","tryCatchPattern":"try { viewModel.Initialize(definitions); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"exactly 1 option\"))\n{\n    logger.Warning(ex, \"Malformed launch option definition; skipping dialog\");\n    // filter out or fix the offending definition before retrying\n}","preventionTips":["Validate package launch-option yaml against the schema at load time.","Only use multiple Options entries with LaunchOptionType.Bool.","Keep package definitions updated after schema changes.","Add unit tests covering each LaunchOptionType shape."],"tags":["launch-options","validation","packages"],"backgroundTag":"schema-validation-failed","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"}