babalae/better-genshin-impact · error · NotSupportedException
foodEffectType参数需要调度器配置,请在调度器下使用
Error message
foodEffectType参数需要调度器配置,请在调度器下使用
What it means
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.
Source
Thrown at BetterGenshinImpact/Core/Script/Dependence/Dispatcher.cs:231
return null;
case "AutoEat":
{
string? foodName = soloTask.Config == null ? null : ScriptObjectConverter.GetValue((ScriptObject)soloTask.Config, "foodName", (string?)null);
FoodEffectType? foodEffectType = soloTask.Config == null ? null : (FoodEffectType?)ScriptObjectConverter.GetValue((ScriptObject)soloTask.Config, "foodEffectType", (int?)null);
if (foodName != null && foodEffectType != null)
{
throw new NotSupportedException("不能同时指定foodName和foodEffectType");
}
if (foodName == null)
{
if (foodEffectType != null)
{
PathingPartyConfig? pathingPartyConfig = _config as PathingPartyConfig;
if (pathingPartyConfig == null)
{
throw new NotSupportedException("foodEffectType参数需要调度器配置,请在调度器下使用");
}
else
{
switch (foodEffectType)
{
case FoodEffectType.ATKBoostingDish:
foodName = pathingPartyConfig.AutoEatConfig.DefaultAtkBoostingDishName;
if (foodName == null)
{
_logger.LogInformation("缺少{Text}配置,跳过吃Buff", "默认的攻击类料理");
return null;
}
break;
case FoodEffectType.AdventurersDish:
foodName = pathingPartyConfig.AutoEatConfig.DefaultAdventurersDishName;
if (foodName == null)
{
_logger.LogInformation("缺少{Text}配置,跳过吃Buff", "默认的冒险类料理");View on GitHub (pinned to a7cb36712d)
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.
Example fix
// before (JS, standalone dispatcher)
dispatcher.RunTask(new SoloTask('AutoEat', { foodEffectType: 1 })); // throws
// after (JS, standalone) — name the dish directly
dispatcher.RunTask(new SoloTask('AutoEat', { foodName: 'Sweet Madame' })); Defensive patterns
Strategy: validation
Validate before calling
// JS side — use foodName for standalone, foodEffectType only under scheduler
if (!isUnderScheduler && foodEffectType != null) {
throw new Error('foodEffectType requires a PathingPartyConfig scheduler; use foodName instead.');
} Type guard
// C# — check the dispatcher config type bool isParty = dispatcher.GetConfig() is PathingPartyConfig;
Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/c75d4861c5943fa1.
Report an issue: GitHub.