babalae/better-genshin-impact · error · PartySetupFailedException
切换角色:设置好感排序失败,{ex.GetBaseException().Message}
Error message
切换角色:设置好感排序失败,{ex.GetBaseException().Message} What it means
EnsureFriendshipSort drives a BvPage flow to set sort mode to '好感' (friendship): wait '顺序', click, wait '好感', click, wait '好感' in the type label. An InvalidOperationException from page.Flow() (typically a WaitUntilText timeout at 2000ms) is caught and rewrapped, so the message carries the inner flow failure.
Source
Thrown at BetterGenshinImpact/GameTask/Common/Job/SwitchCharacterStateMachineTask.cs:1518
SortOptionsRoi1080.X,
SortOptionsRoi1080.Y,
SortOptionsRoi1080.Width,
SortOptionsRoi1080.Height);
try
{
await page.Flow()
.WithDefaultTimeout(2000)
.WithDefaultRetryInterval(200)
.WaitUntilText("顺序", sortTypeRoi)
.Click()
.WaitUntilText("好感", sortOptionsRoi)
.Click()
.WaitUntilText("好感", sortTypeRoi)
.Run();
}
catch (InvalidOperationException ex)
{
throw new PartySetupFailedException(
$"切换角色:设置好感排序失败,{ex.GetBaseException().Message}");
}
}
/// <summary>
/// 尽力点击排序方向按钮,不校验匹配或点击结果。
/// </summary>
private void ClickSortDirectionButton()
{
using var capture = CaptureToRectArea();
using var sortButton = capture.Find(
RecognitionAssets.Get(@"Common\Job\SwitchCharacter", "SortButton", capture));
if (sortButton.IsExist())
{
sortButton.Click();
}
}
View on GitHub (pinned to a7cb36712d)
Solutions
- Read the inner message (ex.GetBaseException().Message) to identify which WaitUntilText step failed and on which ROI.
- Verify SortTypeRoi1080(116,29,245,38) and SortOptionsRoi1080(111,80,241,372) against the current sort-panel layout and capture scale.
- Raise WithDefaultTimeout above 2000ms if the sort UI animates slowly.
- Ensure the character list is stable before entering friendship-sort (the list-open check should precede this).
Defensive patterns
Strategy: try-catch
Try / catch
try { await switchTask.Start(...); }
catch (PartySetupFailedException ex) when (ex.Message.Contains("设置好感排序失败"))
{ _logger.LogWarning(ex, "好感排序设置失败:检查排序面板 ROI 与文本是否匹配当前版本"); } Prevention
- Keep SortTypeRoi1080 / SortOptionsRoi1080 and the '顺序'/'好感' text current.
- Raise WithDefaultTimeout above 2000ms if the sort UI is slow.
- Ensure the character list is fully loaded before invoking EnsureFriendshipSort.
When it happens
Trigger: page.Flow().WithDefaultTimeout(2000)...Run() throws InvalidOperationException because one of the WaitUntilText steps ('顺序' in SortTypeRoi, '好感' in SortOptionsRoi, or '好感' in SortTypeRoi) was not found within 2000ms.
Common situations: The sort UI text/ROIs (SortTypeRoi1080, SortOptionsRoi1080) do not match the current game version or scale; the sort dropdown did not open after the click; an animation exceeded the 2s per-step budget; the character list wasn't fully loaded when EnsureFriendshipSort ran.
Related errors
- 切换角色:未找到 {misplaced.Slot} 号位的换下按钮
- 切换角色:点击逻辑槽位 {logicalSlot} 的换下按钮后,未在 {RemoveConfirmationTimeo
- 切换角色:点击队伍槽位后未打开角色列表
- 切换角色:角色列表关闭后未返回队伍配置页
- 切换角色:未找到 {rebuildStartSlot} 号位的换下按钮
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/4c04f82b3fa4cd98.
Report an issue: GitHub.