babalae/better-genshin-impact · error · PartySetupFailedException

切换角色:点击队伍槽位后未打开角色列表

Error message

切换角色:点击队伍槽位后未打开角色列表

What it means

RecognizeTeamSlotsFromCharacterList clicks slot 1 (ClickFixedTeamSlot(1)) then waits up to 10x300ms for IsCharacterList (OCR of '元素共鸣' at the top-right) to confirm the character list opened. If the list never appears the team-snapshot step cannot run.

Source

Thrown at BetterGenshinImpact/GameTask/Common/Job/SwitchCharacterStateMachineTask.cs:1372

        throw new PartySetupFailedException(
            $"切换角色:点击逻辑槽位 {logicalSlot} 的换下按钮后,未在 {RemoveConfirmationTimeoutMilliseconds / 1000} 秒内确认操作生效");
    }

    private async Task<List<TeamSlotSnapshot>> RecognizeTeamSlotsFromCharacterList(
        AvatarGridIconRecognizer recognizer,
        int expectedTeamCount,
        CancellationToken ct)
    {
        ClickFixedTeamSlot(1);
        var listOpened = await NewRetry.WaitForAction(() =>
        {
            using var capture = CaptureToRectArea();
            return IsCharacterList(capture);
        }, ct, 10, 300);
        if (!listOpened)
        {
            throw new PartySetupFailedException("切换角色:点击队伍槽位后未打开角色列表");
        }

        List<string?> characterNames = [];
        var lastDetectedCardCount = 0;
        try
        {
            var gridRoi = Rect1080(
                CharacterGridRoi1080.X,
                CharacterGridRoi1080.Y,
                CharacterGridRoi1080.Width,
                CharacterGridRoi1080.Height);
            for (var attempt = 1; attempt <= EmptyCardDetectionRetryCount; attempt++)
            {
                using var capture = CaptureToRectArea(true);
                using var gridRegion = capture.DeriveCrop(gridRoi);
                var cards = DetectCharacterCards(
                    gridRegion.SrcMat, out var rejectedCount, out var connectedComponentCount);
                lastDetectedCardCount = cards.Count;

View on GitHub (pinned to a7cb36712d)

Solutions

  1. Verify ClickFixedTeamSlot's x-coordinate (xs[0]=470 at y=550) lands on slot 1 at the current resolution/scale.
  2. Update the IsCharacterList detector ROI/text ('元素共鸣' at Rect1080(1655,32,106,30)) for the current game version.
  3. Increase the 10-attempt / 300ms-interval budget if list opening is slow on the target machine.
  4. Ensure no overlay is intercepting the click.
Defensive patterns

Strategy: retry

Try / catch

try { await switchTask.Start(...); }
catch (PartySetupFailedException ex) when (ex.Message.Contains("未打开角色列表"))
{ _logger.LogWarning(ex, "点击队伍槽位后角色列表未打开,建议重试"); }

Prevention

When it happens

Trigger: NewRetry.WaitForAction(() => IsCharacterList(capture)) returns false after 10 attempts — the '元素共鸣' text was never detected following the slot click.

Common situations: The slot-1 click missed its target (coordinate/scale drift) so the list never opened; the list opened but the '元素共鸣' ROI/text changed in a game update; a modal blocked the click; capture was stale; the game was mid-transition.

Related errors


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