babalae/better-genshin-impact · error · PartySetupFailedException

未能打开队伍配置界面

Error message

未能打开队伍配置界面

What it means

SwitchPartyTask.Start attempts to open the party-setup screen by sending the OpenPartySetupScreen hotkey up to 2 times, each followed by 7x600ms checks for Bv.IsInPartyViewUi. If neither attempt detects the party-view UI, it throws PartySetupFailedException because it cannot proceed to party selection.

Source

Thrown at BetterGenshinImpact/GameTask/Common/Job/SwitchPartyTask.cs:79

                {
                    await Delay(600, ct);
                    using var raCheck = CaptureToRectArea();
                    if (Bv.IsInPartyViewUi(raCheck))
                    {
                        isOpened = true;
                        break;
                    }
                }

                if (isOpened)
                {
                    break; // 页面已打开,跳出循环
                }
            }

            if (!isOpened)
            {
                throw new PartySetupFailedException("未能打开队伍配置界面");
            }
        }

        await Delay(500, ct);

        using var ra = CaptureToRectArea();
        var partyViewBtn = ra.Find(ElementRecognition.Get("PartyBtnChooseView", ra));

        // OCR 当前队伍名称(无法单字,中间禁止空格)
        var currTeamName = ra.Find(new RecognitionObject
        {
            RecognitionType = RecognitionTypes.Ocr,
            RegionOfInterest = new Rect(partyViewBtn.Right, partyViewBtn.Top, (int)(350 * _assetScale),
                partyViewBtn.Height)
        }).Text;
        
        var tempName = currTeamName
            .Replace("\"", "")        // 移除所有双引号(核心新增,解决日志里的""问题)

View on GitHub (pinned to a7cb36712d)

Solutions

  1. Ensure the game is on the main UI and out of combat/domains where party setup is blocked.
  2. Verify GIActions.OpenPartySetupScreen maps to the correct current hotkey and that input focus is on the game window.
  3. Update the Bv.IsInPartyViewUi detector for the current game version.
  4. Increase maxAttempts or the 7x600ms check budget if the screen loads slowly.
Defensive patterns

Strategy: try-catch

Try / catch

try { await partyTask.Start(partyName, ct); }
catch (PartySetupFailedException ex) when (ex.Message == "未能打开队伍配置界面")
{ _logger.LogError(ex, "打开队伍配置界面失败:检查快捷键绑定与游戏焦点"); }

Prevention

When it happens

Trigger: After confirming main UI, the loop sends SimulateAction(GIActions.OpenPartySetupScreen) twice; all 7 detection checks per attempt return Bv.IsInPartyViewUi==false, so isOpened stays false.

Common situations: The OpenPartySetupScreen hotkey binding changed or is not registered in the current game version; the game ignored input (focus lost, input blocked); Bv.IsInPartyViewUi detector markers changed; a slow load exceeded the ~4.2s per-attempt budget; the party screen was disabled in the current game state (e.g. in combat/domain).

Related errors


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