{"record":{"id":"9027aa47f46a12e2","repo":"babalae/better-genshin-impact","slug":"foodname-foodeffecttype","errorCode":null,"errorMessage":"不能同时指定foodName和foodEffectType","messagePattern":"不能同时指定foodName和foodEffectType","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/Core/Script/Dependence/Dispatcher.cs","lineNumber":221,"sourceCode":"                }\n\n                return await new AutoBossTask(new AutoBossParam(autoBossPath)).Start(cancellationToken);\n\n            case \"AutoFishing\":\n                await new AutoFishingTask(AutoFishingTaskParam.BuildFromSoloTaskConfig(soloTask.Config)).Start(\n                    cancellationToken);\n                return null;\n            case \"AutoCook\":\n                await new AutoCookTask().Start(cancellationToken);\n                return null;\n            case \"AutoEat\":\n                {\n                    string? foodName = soloTask.Config == null ? null : ScriptObjectConverter.GetValue((ScriptObject)soloTask.Config, \"foodName\", (string?)null);\n                    FoodEffectType? foodEffectType = soloTask.Config == null ? null : (FoodEffectType?)ScriptObjectConverter.GetValue((ScriptObject)soloTask.Config, \"foodEffectType\", (int?)null);\n\n                    if (foodName != null && foodEffectType != null)\n                    {\n                        throw new NotSupportedException(\"不能同时指定foodName和foodEffectType\");\n                    }\n\n                    if (foodName == null)\n                    {\n                        if (foodEffectType != null)\n                        {\n                            PathingPartyConfig? pathingPartyConfig = _config as PathingPartyConfig;\n                            if (pathingPartyConfig == null)\n                            {\n                                throw new NotSupportedException(\"foodEffectType参数需要调度器配置，请在调度器下使用\");\n                            }\n                            else\n                            {\n                                switch (foodEffectType)\n                                {\n                                    case FoodEffectType.ATKBoostingDish:\n                                        foodName = pathingPartyConfig.AutoEatConfig.DefaultAtkBoostingDishName;\n                                        if (foodName == null)","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/Core/Script/Dependence/Dispatcher.cs#L203-L239","documentation":"NotSupportedException thrown in the AutoEat case (line 221) when soloTask.Config supplies BOTH foodName and foodEffectType. These are mutually exclusive: foodName names a specific dish, foodEffectType picks a category whose default dish is resolved from scheduler config. Providing both is ambiguous, so the dispatcher rejects it.","triggerScenarios":"JS constructs `new SoloTask('AutoEat', { foodName: 'Sweet Madame', foodEffectType: 1 })` — both keys present and non-null. Script author copied an example and forgot to delete one field.","commonSituations":"Author intended to override but set both keys. Config object was merged from two sources, each setting one field.","solutions":["Provide exactly one of foodName or foodEffectType in the AutoEat config.","If you want a specific dish, set only foodName.","If you want a category default, set only foodEffectType AND run under a scheduler (see error 67)."],"exampleFix":"// before (JS)\nnew SoloTask('AutoEat', { foodName: 'Sweet Madame', foodEffectType: 1 })\n\n// after (JS) — specific dish\nnew SoloTask('AutoEat', { foodName: 'Sweet Madame' })\n// or category default\nnew SoloTask('AutoEat', { foodEffectType: 1 })","handlingStrategy":"validation","validationCode":"// JS side\nconst cfg = {};\nif (foodName) cfg.foodName = foodName;\nelse if (foodEffectType != null) cfg.foodEffectType = foodEffectType;\nif (foodName && foodEffectType != null) throw new Error('Set only one of foodName or foodEffectType');\ndispatcher.RunTask(new SoloTask('AutoEat', cfg));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat foodName and foodEffectType as mutually exclusive in script authoring.","Build the config object from a single source to avoid merging both keys.","Document the exclusivity clearly in script templates."],"tags":["script","autoeat","config","validation","mutually-exclusive"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}