babalae/better-genshin-impact · error · Exception
连续战斗失败{MaxConsecutiveFailures}次,任务终止
Error message
连续战斗失败{MaxConsecutiveFailures}次,任务终止 What it means
Thrown by the catch block in ExecutePathsUsingNodeData when an exception containing '战斗失败' (combat failure) in its message has been caught MaxConsecutiveFailures (5) times in a row. Each combat failure increments _consecutiveFailureCount; reaching the threshold means the task is in a persistent failure loop (e.g. the combat strategy is too weak, the team composition is wrong, or the ley line enemy is too difficult) and continuing would waste resin or soft-lock the automation.
Source
Thrown at BetterGenshinImpact/GameTask/AutoLeyLineOutcrop/AutoLeyLineOutcropTask.cs:504
StartNode = currentNode,
TargetNode = selected.Value.Node,
Routes = [selected.Value.Route]
};
await ExecutePath(path);
_currentRunTimes++;
currentNode = selected.Value.Node;
}
}
}
catch (Exception ex)
{
if (ex.Message.Contains("战斗失败", StringComparison.OrdinalIgnoreCase))
{
_consecutiveFailureCount++;
if (_consecutiveFailureCount >= MaxConsecutiveFailures)
{
await EnsureExitRewardPage();
throw new Exception($"连续战斗失败{MaxConsecutiveFailures}次,任务终止");
}
await EnsureExitRewardPage();
_logger.LogInformation("战斗失败,重新寻找地脉花");
return;
}
await EnsureExitRewardPage();
throw;
}
}
private (string Route, Node Node)? SelectBranchRoute(NodeData nodeData, Node currentNode)
{
string? selectedRoute = null;
Node? selectedNode = null;
var closest = double.MaxValue;
View on GitHub (pinned to a7cb36712d)
Solutions
- Switch to a stronger combat team or upgrade the auto-fight strategy.
- Increase FightConfig.Timeout to allow more time for the fight to complete.
- Check that the team composition matches a team name that exists in the game.
- Manually complete one ley line fight to verify the enemy difficulty, then adjust the strategy.
- If intermittent, lower the ley line count or disable the task temporarily.
Defensive patterns
Strategy: try-catch
Try / catch
catch (Exception ex) when (ex.Message.Contains($"连续战斗失败{MaxConsecutiveFailures}次"))
{
logger.LogError("连续战斗失败达上限,请调整战斗策略或队伍配置后重试");
Notify.Event("AutoLeyLineOutcrop").Error("连续战斗失败,请检查队伍配置");
// surface to user, do not silently retry
} Prevention
- Use a combat team and strategy strong enough for ley line enemies.
- Set an adequate FightConfig.Timeout (do not set it too low).
- Monitor _consecutiveFailureCount and proactively warn the user before the threshold is reached.
- Test the combat strategy manually before running unattended.
When it happens
Trigger: The ProcessLeyLineOutcrop combat step throws an exception whose message includes '战斗失败'. This happens 5 consecutive times. On the 5th, EnsureExitRewardPage is called and the exception is thrown to terminate the task.
Common situations: The configured combat strategy/team is too weak for the ley line enemy; the auto-fight script has a bug causing repeated losses; character levels/artifacts are insufficient; the fight timed out repeatedly (FightConfig.Timeout too low); a game update changed enemy behavior making the strategy ineffective.
Related errors
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/29eedb880b4a77a6.
Report an issue: GitHub.