{"record":{"id":"c75d4861c5943fa1","repo":"babalae/better-genshin-impact","slug":"foodeffecttype","errorCode":null,"errorMessage":"foodEffectType参数需要调度器配置，请在调度器下使用","messagePattern":"foodEffectType参数需要调度器配置，请在调度器下使用","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/Core/Script/Dependence/Dispatcher.cs","lineNumber":231,"sourceCode":"                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)\n                                        {\n                                            _logger.LogInformation(\"缺少{Text}配置，跳过吃Buff\", \"默认的攻击类料理\");\n                                            return null;\n                                        }\n                                        break;\n                                    case FoodEffectType.AdventurersDish:\n                                        foodName = pathingPartyConfig.AutoEatConfig.DefaultAdventurersDishName;\n                                        if (foodName == null)\n                                        {\n                                            _logger.LogInformation(\"缺少{Text}配置，跳过吃Buff\", \"默认的冒险类料理\");","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/Core/Script/Dependence/Dispatcher.cs#L213-L249","documentation":"NotSupportedException thrown at line 231 when foodEffectType is set but `this._config` is not a PathingPartyConfig. foodEffectType needs to resolve a default dish name from PathingPartyConfig.AutoEatConfig, which only exists when the Dispatcher was constructed for party/pathing scheduled execution. A standalone Dispatcher (constructed with a plain object config) has no party defaults, so the feature is unavailable.","triggerScenarios":"Script calls `dispatcher.RunTask(new SoloTask('AutoEat', { foodEffectType: 1 }))` on a Dispatcher whose config is not PathingPartyConfig — i.e. not running inside the scheduler/party pipeline.","commonSituations":"Using AutoEat with foodEffectType in a standalone script instead of inside a party config. The Dispatcher was constructed with a non-PathingPartyConfig object by mistake.","solutions":["For standalone AutoEat, use foodName directly instead of foodEffectType.","To use foodEffectType, ensure the Dispatcher is built with a PathingPartyConfig (run under the scheduler).","Pre-resolve the dish name yourself and pass it via foodName."],"exampleFix":"// before (JS, standalone dispatcher)\ndispatcher.RunTask(new SoloTask('AutoEat', { foodEffectType: 1 })); // throws\n\n// after (JS, standalone) — name the dish directly\ndispatcher.RunTask(new SoloTask('AutoEat', { foodName: 'Sweet Madame' }));","handlingStrategy":"validation","validationCode":"// JS side — use foodName for standalone, foodEffectType only under scheduler\nif (!isUnderScheduler && foodEffectType != null) {\n  throw new Error('foodEffectType requires a PathingPartyConfig scheduler; use foodName instead.');\n}","typeGuard":"// C# — check the dispatcher config type\nbool isParty = dispatcher.GetConfig() is PathingPartyConfig;","tryCatchPattern":null,"preventionTips":["Use foodName for standalone AutoEat; reserve foodEffectType for party/scheduler runs.","Know which Dispatcher config type you are running under before using category defaults.","Pre-resolve dish names in standalone scripts."],"tags":["script","autoeat","scheduler","config","pathing-party"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}