babalae/better-genshin-impact · error · NotSupportedException
不能同时指定foodName和foodEffectType
Error message
不能同时指定foodName和foodEffectType
What it means
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.
Source
Thrown at BetterGenshinImpact/Core/Script/Dependence/Dispatcher.cs:221
}
return await new AutoBossTask(new AutoBossParam(autoBossPath)).Start(cancellationToken);
case "AutoFishing":
await new AutoFishingTask(AutoFishingTaskParam.BuildFromSoloTaskConfig(soloTask.Config)).Start(
cancellationToken);
return null;
case "AutoCook":
await new AutoCookTask().Start(cancellationToken);
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)View on GitHub (pinned to a7cb36712d)
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).
Example fix
// before (JS)
new SoloTask('AutoEat', { foodName: 'Sweet Madame', foodEffectType: 1 })
// after (JS) — specific dish
new SoloTask('AutoEat', { foodName: 'Sweet Madame' })
// or category default
new SoloTask('AutoEat', { foodEffectType: 1 }) Defensive patterns
Strategy: validation
Validate before calling
// JS side
const cfg = {};
if (foodName) cfg.foodName = foodName;
else if (foodEffectType != null) cfg.foodEffectType = foodEffectType;
if (foodName && foodEffectType != null) throw new Error('Set only one of foodName or foodEffectType');
dispatcher.RunTask(new SoloTask('AutoEat', cfg)); Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Author intended to override but set both keys. Config object was merged from two sources, each setting one field.
Related errors
- foodEffectType参数需要调度器配置,请在调度器下使用
- JS脚本入参错误:错误的foodEffectType
- 未找到名称为 {objectName} 的 RecognitionObject 配置
- 对象 {objectName} 缺少 template 配置
- 表达式 {expression} 未返回 Rect
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/9027aa47f46a12e2.
Report an issue: GitHub.