{"record":{"id":"bf5158b40f6a251f","repo":"babalae/better-genshin-impact","slug":"rebuildstartslot","errorCode":null,"errorMessage":"切换角色：未找到 {rebuildStartSlot} 号位的换下按钮","messagePattern":"切换角色：未找到 (.+?) 号位的换下按钮","errorType":"exception","errorClass":"PartySetupFailedException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/Common/Job/SwitchCharacterStateMachineTask.cs","lineNumber":620,"sourceCode":"            if (firstMismatchSlot == null)\n            {\n                throw new PartySetupFailedException(\"切换角色：换下错位角色后无法确定需要补回的槽位\");\n            }\n\n            StartSuffixRebuild(firstMismatchSlot.Value);\n            _prepareSuffixRebuildAfterRemoval = false;\n        }\n\n        if (_rebuildStartSlot is int rebuildStartSlot)\n        {\n            var minimumRetainedCount = Math.Max(1, rebuildStartSlot - 1);\n            if (_isRebuildClearing && _currentTeamSlots.Count > minimumRetainedCount)\n            {\n                ClickFixedTeamSlot(rebuildStartSlot);\n                await Delay(500, _ct);\n                if (!TryClickText(page, \"换下\", Rect1080(382, 994, 87, 51)))\n                {\n                    throw new PartySetupFailedException($\"切换角色：未找到 {rebuildStartSlot} 号位的换下按钮\");\n                }\n\n                await WaitForRoleRemoved(rebuildStartSlot, _ct);\n                _expectedTeamCount--;\n                _teamSnapshotDirty = true;\n                return StateHandlerResult.Wait;\n            }\n\n            _isRebuildClearing = false;\n\n            if (_rebuildRoles.Count > 0)\n            {\n                var refillRole = _rebuildRoles.Peek();\n                if (_roleSwitchAttempts.GetValueOrDefault(refillRole.Slot) >= MaxRoleSwitchAttempts)\n                {\n                    throw new PartySetupFailedException(\n                        $\"切换角色：{refillRole.Slot} 号位连续 {MaxRoleSwitchAttempts} 次未能补回 {refillRole.Name}\");\n                }","sourceCodeStart":602,"sourceCodeEnd":638,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/Common/Job/SwitchCharacterStateMachineTask.cs#L602-L638","documentation":"Thrown during the suffix-rebuild clearing phase: after clicking the rebuildStartSlot team slot and waiting 500ms, TryClickText(page, \"换下\", Rect1080(382,994,87,51)) cannot find the localized '换下' (remove) button, so the role cannot be removed to make room.","triggerScenarios":"_isRebuildClearing is true, _currentTeamSlots.Count > minimumRetainedCount, ClickFixedTeamSlot(rebuildStartSlot) is issued, but the subsequent '换下' text search inside Rect1080(382,994,87,51) fails. The slot click did not open the expected detail panel, or the button text/position differs.","commonSituations":"The slot click missed or opened the wrong panel (no '换下' button rendered); localization mismatch on '换下'; the 500ms wait was too short for the detail panel; resolution drift moved the button off Rect1080(382,994,87,51); the slot was already empty.","solutions":["Re-click the slot and re-search '换下' once more after a longer delay before failing.","Confirm the '换下' string and the Rect1080(382,994,87,51) region match the current game locale/scale.","Verify ClickFixedTeamSlot actually selects a populated slot before searching for the remove button.","If the slot is already empty (count already at minimum), skip clearing instead of searching for the button."],"exampleFix":"// before\nClickFixedTeamSlot(rebuildStartSlot);\nawait Delay(500, _ct);\nif (!TryClickText(page, \"换下\", Rect1080(382, 994, 87, 51)))\n{\n    throw new PartySetupFailedException($\"切换角色：未找到 {rebuildStartSlot} 号位的换下按钮\");\n}\n\n// after: one retry with a longer wait\nClickFixedTeamSlot(rebuildStartSlot);\nawait Delay(500, _ct);\nif (!TryClickText(page, \"换下\", Rect1080(382, 994, 87, 51)))\n{\n    await Delay(500, _ct);\n    ClickFixedTeamSlot(rebuildStartSlot);\n    await Delay(500, _ct);\n}\nif (!TryClickText(page, \"换下\", Rect1080(382, 994, 87, 51)))\n    throw new PartySetupFailedException($\"切换角色：未找到 {rebuildStartSlot} 号位的换下按钮\");","handlingStrategy":"retry","validationCode":"null","typeGuard":"null","tryCatchPattern":"try { await sm.Start(s1, s2, s3, s4, usePhysicalSlots, ct); }\ncatch (PartySetupFailedException e) when (e.Message.Contains(\"换下按钮\"))\n{ /* re-click the slot after a longer delay, verify locale, then retry */ }","preventionTips":["Confirm '换下' and Rect1080(382,994,87,51) match the current locale/scale.","Re-click the slot and re-search once before failing.","Skip clearing when the slot is already at the minimum retained count."],"tags":["party-setup","state-machine","ui-automation","localization"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}