babalae/better-genshin-impact · error · InvalidOperationException
未能完整识别普通攻击、元素战技和元素爆发三个天赋。
Error message
未能完整识别普通攻击、元素战技和元素爆发三个天赋。
What it means
After iterating all talent points, the set of recognized talent types must equal exactly {普通攻击, 元素战技, 元素爆发}. If OCR/normalization missed one type or duplicated another, the trio is incomplete and the result would be wrong, so the handler throws rather than return partial data.
Source
Thrown at BetterGenshinImpact/GameTask/CharacterDevelopment/CharacterDevelopmentTask.cs:820
var (type, level, hasBonus) = await ReadTalentDetailWithRetry();
if (!_readTalentTypes.Add(type))
{
return StateHandlerResult.Retry;
}
ApplyTalentResult(CurrentResult, type, level, hasBonus);
_talentIndex++;
if (_talentIndex < _talentPoints.Count)
{
_workflowState = CharacterDevelopmentState.OpenTalent;
}
else
{
if (!_readTalentTypes.SetEquals([AttackTalentType, SkillTalentType, BurstTalentType]))
{
throw new InvalidOperationException("未能完整识别普通攻击、元素战技和元素爆发三个天赋。");
}
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_ESCAPE);
_workflowState = CharacterDevelopmentState.SwitchCategory;
}
return StateHandlerResult.Success;
}
[StateHandler(CharacterDevelopmentState.ReturnMainUi, RetryTimeout = 15000, RetryInterval = 500, TransitionTimeout = 7000)]
private async Task<StateHandlerResult> HandleReturnMainUi(BvPage page)
{
await _returnMainUiTask.Start(_ct);
_workflowState = CharacterDevelopmentState.Completed;
return StateHandlerResult.Success;
}
#endregionView on GitHub (pinned to a7cb36712d)
Solutions
- Improve capture timing (wait for the talent detail panel to fully render before reading).
- Adjust the talent-title OCR ROI or preprocessing if the UI layout changed.
- Retry the talent sub-flow once on failure before aborting the whole character.
Example fix
// before
if (!_readTalentTypes.SetEquals([AttackTalentType, SkillTalentType, BurstTalentType]))
throw new InvalidOperationException(...);
// after: retry the talent flow once, then fail
catch (InvalidOperationException) when (talentRetries++ < 1) { _workflowState = FindTalentEntries; return StateHandlerResult.Success; } Defensive patterns
Strategy: retry
Validate before calling
// Before declaring success, the handler already checks completeness; // reduce transient OCR failures by ensuring the panel is fully rendered.
Try / catch
try { /* talent read loop */ }
catch (InvalidOperationException ex) when (ex.Message.Contains("未能完整识别"))
{ /* retry the FindTalentEntries→OpenTalent→ReadTalent flow once */ } Prevention
- Wait for the talent detail panel to finish its open animation before reading.
- Keep talent-title ROIs aligned with the current layout.
- Retry the talent sub-flow once before aborting the character.
When it happens
Trigger: `NormalizeTalentType` returned empty for one of the three points (OCR failed to read the talent name); a talent point's OCR resolved to the same type twice; `TryFindTalentPoints` picked a non-talent 'Lv' region.
Common situations: Low OCR confidence on the talent title region; UI animation/partial render during capture; a layout change shifting which 'Lv' text gets picked.
Related errors
- 无法读取分类 {_currentCategory}。
- 天赋点击位置索引越界。
- 天赋详情 OCR 在 {MaxOcrAttempts} 次内未达到连续 {RequiredStableOcrCount}
- 角色养成识别:头像识别器尚未初始化。
- 角色养成识别:当前角色尚未初始化。
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/143b464c340160d4.
Report an issue: GitHub.