{"record":{"id":"b57880c4be30e1a0","repo":"babalae/better-genshin-impact","slug":"solotask-name","errorCode":null,"errorMessage":"未知的任务名称: {soloTask.Name}","messagePattern":"未知的任务名称: (.+?)","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/Core/Script/Dependence/Dispatcher.cs","lineNumber":310,"sourceCode":"\n                    var result = await new CountInventoryItem(param).Start(cancellationToken);\n                    if (param.ItemName != null)\n                    {\n                        return result;\n                    }\n                    else\n                    {\n                        dynamic expando = new ExpandoObject();\n                        var expandoDict = (IDictionary<string, object>)expando;\n                        foreach (var kvp in (Dictionary<string, int>)result)\n                        {\n                            expandoDict[kvp.Key] = kvp.Value;\n                        }\n                        return expandoDict;\n                    }\n                }\n            default:\n                throw new ArgumentException($\"未知的任务名称: {soloTask.Name}\", nameof(soloTask.Name));\n        }\n    }\n\n    public CancellationTokenSource GetLinkedCancellationTokenSource()\n    {\n        // 创建一个新的链接令牌源，链接到全局令牌\n        return CancellationTokenSource.CreateLinkedTokenSource(CancellationContext.Instance.Cts.Token);\n    }\n\n\n    public CancellationToken GetLinkedCancellationToken()\n    {\n        return GetLinkedCancellationTokenSource().Token;\n    }\n    \n    /// <summary>  \n    /// 运行自动秘境任务\n    /// </summary>  ","sourceCodeStart":292,"sourceCodeEnd":328,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/Core/Script/Dependence/Dispatcher.cs#L292-L328","documentation":"ArgumentException thrown at line 310 in the default branch of the RunTask switch. soloTask.Name did not match any cased task name (AutoGeniusInvokation, AutoWood, AutoFight, AutoDomain, AutoBoss, AutoFishing, AutoCook, AutoEat, CountInventoryItem). The name is matched as an exact, case-sensitive string literal.","triggerScenarios":"JS constructs `new SoloTask('AutoDomain ')` (trailing space), `new SoloTask('autodomain')` (wrong case), or `new SoloTask('AutoMine')` (nonexistent task).","commonSituations":"Typo or casing error. Using a task name from a different version. Trailing whitespace from string concatenation in JS.","solutions":["Use an exact task name from the supported list (AutoGeniusInvokation, AutoWood, AutoFight, AutoDomain, AutoBoss, AutoFishing, AutoCook, AutoEat, CountInventoryItem).","Trim and verify the name in JS before constructing the SoloTask.","Maintain a constant list of valid names in your script to avoid typos."],"exampleFix":"// before (JS)\ndispatcher.RunTask(new SoloTask('AutoDomain ')); // trailing space -> default -> throws\n\n// after (JS)\ndispatcher.RunTask(new SoloTask('AutoDomain')); // exact match","handlingStrategy":"validation","validationCode":"// JS side\nconst VALID_TASKS = ['AutoGeniusInvokation','AutoWood','AutoFight','AutoDomain','AutoBoss','AutoFishing','AutoCook','AutoEat','CountInventoryItem'];\nif (!VALID_TASKS.includes(name)) throw new Error(`Unknown task name: ${name}`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use exact, case-sensitive task names from the supported list.","Trim whitespace from names built by string concatenation.","Maintain a constant list of valid task names in your script."],"tags":["script","dispatcher","unknown-task","validation"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}