{"record":{"id":"36ca6b64a541d41e","repo":"babalae/better-genshin-impact","slug":"error-36ca6b","errorCode":null,"errorMessage":"至少需要指定一个读取分类。","messagePattern":"至少需要指定一个读取分类。","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/CharacterDevelopment/CharacterDevelopmentTask.cs","lineNumber":272,"sourceCode":"    private AvatarGridIconRecognizer Recognizer =>\n        _recognizer ?? throw new InvalidOperationException(\"角色养成识别：头像识别器尚未初始化。\");\n\n    private CharacterSelectionTarget CurrentTarget =>\n        _currentTarget ?? throw new InvalidOperationException(\"角色养成识别：当前角色尚未初始化。\");\n\n    private CharacterDevelopmentResult CurrentResult =>\n        _currentResult ?? throw new InvalidOperationException(\"角色养成识别：当前结果尚未初始化。\");\n\n    public CharacterDevelopmentStateMachineTask(IReadOnlyList<string> characterNames, CharacterDevelopmentCategory categories)\n    {\n        if (characterNames.Count == 0)\n        {\n            throw new ArgumentException(\"至少需要指定一个角色。\", nameof(characterNames));\n        }\n\n        if (categories == CharacterDevelopmentCategory.None)\n        {\n            throw new ArgumentException(\"至少需要指定一个读取分类。\", nameof(categories));\n        }\n\n        _categories = categories;\n        _targets = characterNames.Select(CharacterSelectionHelper.CreateTarget).ToList();\n        var captureRect = TaskContext.Instance().SystemInfo.ScaleMax1080PCaptureRect;\n        _assets = CharacterDevelopmentAssets.Get(captureRect.Width, captureRect.Height);\n\n        RegisterStateMethodsByAttribute();\n        RegisterStateTransitions(\n            (CharacterDevelopmentState.Unknown, [CharacterDevelopmentState.MainUi, CharacterDevelopmentState.OpenCharacterList]),\n            (CharacterDevelopmentState.MainUi, [CharacterDevelopmentState.OpenCharacterList]),\n            (CharacterDevelopmentState.OpenCharacterList, [CharacterDevelopmentState.OpenFilterPanel]),\n            (CharacterDevelopmentState.OpenFilterPanel, [CharacterDevelopmentState.FilterPanel]),\n            (CharacterDevelopmentState.FilterPanel, [CharacterDevelopmentState.SelectElementFilter, CharacterDevelopmentState.SelectWeaponFilter]),\n            (CharacterDevelopmentState.SelectElementFilter, [CharacterDevelopmentState.SelectWeaponFilter]),\n            (CharacterDevelopmentState.SelectWeaponFilter, [CharacterDevelopmentState.ConfirmFilterPanel]),\n            (CharacterDevelopmentState.ConfirmFilterPanel, [CharacterDevelopmentState.FindAndClickAvatar]),\n            (CharacterDevelopmentState.FindAndClickAvatar, [CharacterDevelopmentState.SelectedCharacter]),","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/CharacterDevelopment/CharacterDevelopmentTask.cs#L254-L290","documentation":"Constructor argument check: `categories` must not be `CharacterDevelopmentCategory.None`. The flags enum uses `None = 0` to mean \"nothing requested\", and the task has nothing to do without at least one of Attribute/Weapon/Talent, so it rejects `None` with `ArgumentException`.","triggerScenarios":"Passing `CharacterDevelopmentCategory.None` (value 0), or a default/uninitialized `CharacterDevelopmentCategory` variable, or a category string that `ParseCategories` maps to `None`.","commonSituations":"Caller forgets to set a category; config field left empty and parsed as None; passing `default(CharacterDevelopmentCategory)`.","solutions":["Pass at least one flag, e.g. `CharacterDevelopmentCategory.Attribute | CharacterDevelopmentCategory.Weapon`.","When parsing user input, map empty/null to `All` (as `GetCharacter` does) instead of `None`.","Validate the parsed flags are non-zero before constructing the task."],"exampleFix":"// before\nvar cats = ParseCategories(userInput); // may be None\nvar task = new CharacterDevelopmentStateMachineTask(names, cats);\n\n// after\nvar cats = ParseCategories(userInput);\nif (cats == CharacterDevelopmentCategory.None) cats = CharacterDevelopmentCategory.All;\nvar task = new CharacterDevelopmentStateMachineTask(names, cats);","handlingStrategy":"validation","validationCode":"if (categories == CharacterDevelopmentCategory.None)\n    categories = CharacterDevelopmentCategory.All; // or throw at the call site","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Map empty/null category input to All (as GetCharacter does) instead of None.","Validate parsed flags are non-zero before constructing the task.","Never pass default(CharacterDevelopmentCategory) intentionally."],"tags":["argument-validation","constructor","flags-enum","character-development"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}