babalae/better-genshin-impact · error · Exception
配置好感队时必须配置战斗队伍
Error message
配置好感队时必须配置战斗队伍
What it means
Thrown by ValidateSettings when FriendshipTeam is set (non-whitespace) but Team is empty/whitespace. The friendship team feature requires the automation to first run combat with a 'combat team' and then switch to a designated 'friendship team' to claim the reward (so friendship XP goes to specific characters). Without a combat team configured, the friendship-team switching logic has no team to switch back to after the reward, making the feature unsafe to run.
Source
Thrown at BetterGenshinImpact/GameTask/AutoLeyLineOutcrop/AutoLeyLineOutcropTask.cs:196
if (string.IsNullOrWhiteSpace(_taskParam.LeyLineOutcropType))
{
throw new Exception("地脉花类型未选择");
}
if (_taskParam.LeyLineOutcropType != "启示之花" && _taskParam.LeyLineOutcropType != "藏金之花")
{
throw new Exception("地脉花类型无效,请重新选择");
}
if (string.IsNullOrWhiteSpace(_taskParam.Country))
{
throw new Exception("国家未配置");
}
if (!string.IsNullOrWhiteSpace(_taskParam.FriendshipTeam) && string.IsNullOrWhiteSpace(_taskParam.Team))
{
throw new Exception("配置好感队时必须配置战斗队伍");
}
if (_taskParam.Count < 1)
{
_taskParam.Count = 1;
}
if (string.IsNullOrWhiteSpace(_taskParam.FightConfig.StrategyName) && _taskParam.Timeout > 0)
{
_taskParam.FightConfig.Timeout = _taskParam.Timeout;
}
if (_taskParam.FightConfig.Timeout <= 0)
{
_taskParam.FightConfig.Timeout = _taskParam.Timeout > 0 ? _taskParam.Timeout : 120;
}
else
{View on GitHub (pinned to a7cb36712d)
Solutions
- Set the Team (combat team) field in the configuration whenever FriendshipTeam is used.
- Alternatively, clear the FriendshipTeam field if friendship XP routing is not needed.
- Verify both fields are populated correctly in the ley line task settings UI.
Example fix
// before taskParam.FriendshipTeam = "好感队1"; taskParam.Team = ""; // missing combat team // after taskParam.FriendshipTeam = "好感队1"; taskParam.Team = "战斗队1";
Defensive patterns
Strategy: validation
Validate before calling
// Before starting, validate the friendship team constraint
if (!string.IsNullOrWhiteSpace(taskParam.FriendshipTeam)
&& string.IsNullOrWhiteSpace(taskParam.Team))
{
Logger.LogError("配置好感队时必须同时配置战斗队伍");
return;
} Type guard
public static bool IsValidTeamConfig(AutoLeyLineOutcropParam param)
{
return string.IsNullOrWhiteSpace(param.FriendshipTeam)
|| !string.IsNullOrWhiteSpace(param.Team);
} Prevention
- When using a friendship team, always configure a combat team as well.
- Add UI-side validation that requires Team when FriendshipTeam is filled.
- Clear FriendshipTeam if friendship XP routing is not needed.
When it happens
Trigger: A user configured a friendship team name (FriendshipTeam) but left the main combat team (Team) empty. This is an invalid combination because the task needs to switch between the two.
Common situations: User filled in the friendship-team field but forgot to set the combat team in the UI; a configuration was partially edited; the friendship feature was enabled without understanding the two-team requirement.
Related errors
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/5bd23aa37d164903.
Report an issue: GitHub.