babalae/better-genshin-impact · critical · Exception

战斗失败

Error message

战斗失败

What it means

Thrown when AutoFight(timeoutSeconds) returned false (the combat was lost) AND ProcessResurrect() also returned false (no revive was possible/executed). The task cannot continue without a living team.

Source

Thrown at BetterGenshinImpact/GameTask/AutoLeyLineOutcrop/AutoLeyLineOutcropTask.cs:989

                _logger.LogWarning("纠偏路径不存在,回退target路径: {Path}", recoverPath);
                recoverPath = targetPath;
            }

            _logger.LogDebug("未识别到战斗提示,执行纠偏路径: {Path}", recoverPath);
            await RunPathingFile(recoverPath);
            return await ProcessLeyLineOutcrop(timeoutSeconds, targetPath, rerunPath, fromTeleportStart, retries + 1);
        }

        var fightResult = await AutoFight(timeoutSeconds);
        if (!fightResult)
        {
            await EnsureExitRewardPage();
            if (await ProcessResurrect())
            {
                return await ProcessLeyLineOutcrop(timeoutSeconds, targetPath, rerunPath, fromTeleportStart, retries + 1);
            }

            throw new Exception("战斗失败");
        }

        await TryCollectDropsAfterFight();
        await SwitchToFriendshipTeamIfNeeded();
        await AutoNavigateToReward();
        return true;
    }

    private async Task TryCollectDropsAfterFight()
    {
        if (!_taskParam.FightConfig.KazuhaPickupEnabled)
        {
            return;
        }

        try
        {
            var combatScenes = await RunnerContext.Instance.GetCombatScenes(_ct);

View on GitHub (pinned to a7cb36712d)

Solutions

  1. Use a stronger team / a combat strategy that matches the current party composition.
  2. Ensure revive capability (food/characters) is available so ProcessResurrect can succeed.
  3. Lower the blossom difficulty by picking an appropriate region/type, or farm with a geared team.
  4. Verify the fight strategy isn't stuck (e.g., wrong element rotation).
Defensive patterns

Strategy: try-catch

Try / catch

try { await ProcessLeyLineOutcrop(...); }
catch (Exception ex) when (ex.Message == "战斗失败")
{
    _logger.LogError("地脉战斗失败且无法复活,请检查队伍配置与复活手段");
    await EnsureExitRewardPage();
    throw;
}

Prevention

When it happens

Trigger: In ProcessLeyLineOutcrop, fightResult is false; EnsureExitRewardPage runs; ProcessResurrect() is awaited and returns false; the exception is then thrown.

Common situations: Team too weak for the blossom enemies; no revive items/characters available; the fight strategy file is mismatched for the current team; HP depleted before the strategy could act.

Related errors


AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13). Data as JSON: /api/errors/57ceb9ff5a823884. Report an issue: GitHub.