babalae/better-genshin-impact · error · Exception
识别队伍角色失败!
Error message
识别队伍角色失败!
What it means
Exception from AutoStygianOnslaughtTask.InitializeCombatScenesLoop when NewRetry.WaitForAction fails to produce a team-initialized CombatScenes within 10 attempts at 500ms intervals. CombatScenes.InitializeTeam runs AssertUtils.CheckGameResolution then classifies avatar side icons; CheckTeamInitialized returns false when Avatars.Length != ExpectedTeamAvatarNum.
Source
Thrown at BetterGenshinImpact/GameTask/AutoStygianOnslaught/AutoStygianOnslaughtTask.cs:833
if (gameScreenSize.Width < 1920 || gameScreenSize.Height < 1080)
{
Logger.LogWarning("游戏窗口分辨率小于 1920x1080 !当前分辨率为 {Width}x{Height}",
gameScreenSize.Width, gameScreenSize.Height);
}
}
private async Task<CombatScenes> InitializeCombatScenesLoop()
{
CombatScenes? result = null;
var found = await NewRetry.WaitForAction(() =>
{
result = new CombatScenes().InitializeTeam(CaptureToRectArea());
return result.CheckTeamInitialized();
}, _ct, 10, 500);
if (!found || result == null)
{
throw new Exception("识别队伍角色失败!");
}
Logger.LogInformation($"{Name}:队伍初始化成功");
return result;
}
private async Task<List<CombatCommand>> PrepareForBattleLoop(CombatScenes combatScenes)
{
var combatCommands = FindCombatScriptAndSwitchAvatar(combatScenes);
await Delay(1500, _ct);
Simulation.SendInput.SimulateAction(GIActions.MoveForward, KeyType.KeyDown);
await Delay(1200, _ct);
Simulation.SendInput.SimulateAction(GIActions.MoveForward, KeyType.KeyUp);
return combatCommands;
}
private List<CombatCommand> FindCombatScriptAndSwitchAvatar(CombatScenes combatScenes)View on GitHub (pinned to a7cb36712d)
Solutions
- Start the task only when the game shows the normal in-world team view (avatars visible in the bottom-right).
- Run at 1920x1080 16:9 (the side-icon classifier is resolution-calibrated).
- Optionally set AutoFightConfig.TeamNames manually to bypass OCR classification.
- Disable HDR or fix capture color so avatar icons match templates.
- Retry after closing any overlay/menu that occludes the avatar sidebar.
Defensive patterns
Strategy: retry
Try / catch
try { scenes = await InitializeCombatScenesLoop(); }
catch (Exception e) when (e.Message.Contains("识别队伍角色失败"))
{ /* return to main UI, confirm team visible, then retry once */ } Prevention
- Start combat tasks only on the in-world screen with the avatar sidebar visible.
- Optionally set TeamNames in AutoFightConfig to bypass OCR classification.
- Run at 1920x1080 and disable HDR for reliable avatar-icon classification.
When it happens
Trigger: Team/avatar sidebar not visible on screen during the retry window (wrong UI state, overlay blocking the sidebar, in a cutscene/loading); avatar classifier returning empty names for all slots so BuildAvatars produces fewer Avatars than ExpectedTeamAvatarNum; ExpectedTeamAvatarNum detected as 0 because PartyAvatarSideIndexHelper found no index rects.
Common situations: Task started while not on the combat/pre-battle screen; resolution not 1920x1080 so icon templates don't match; team slot detection misreads in co-op; HDR capture producing washed-out frames; team config (TeamNames) left empty so OCR path is used and fails.
Related errors
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/e958338257424415.
Report an issue: GitHub.