babalae/better-genshin-impact · error · InvalidOperationException
天赋详情 OCR 在 次内未达到连续 次一致,最大连续次数= ,末次结果=
Error message
天赋详情 OCR 在 {MaxOcrAttempts} 次内未达到连续 {RequiredStableOcrCount} 次一致,最大连续次数={stableValues.MaxConsecutiveCount},末次结果={lastResult} What it means
`ReadTalentDetailWithRetry` requires 3 consecutive identical (type, level, hasBonus) triples within 10 attempts. Failure means the talent detail panel OCR never stabilized, so it throws rather than record an inconsistent talent level.
Solutions
- Wait for the talent detail panel to fully render before the first read (increase `TransitionTimeout`/delay).
- Re-align the talent ROIs (`Rect1080(242,13,98,36)` title, `(256,168,66,25)` level, `(35,285,146,30)` bonus) to the current layout.
- Increase `MaxOcrAttempts` if the jitter is transient.
- Preprocess the talent-title ROI to make 普通攻击/元素战技/元素爆发 reliably distinguishable.
Example fix
// before var detail = await ReadTalentDetailWithRetry(); // throws on jitter // after: ensure panel rendered + tuned ROIs await Delay(400, _ct); // let animation settle var detail = await ReadTalentDetailWithRetry();
Defensive patterns
Strategy: retry
Validate before calling
// Let the talent detail panel fully render before reading; // confirm talent ROIs are aligned to the current layout.
Try / catch
try { await ReadTalentDetailWithRetry(); }
catch (InvalidOperationException ex) when (ex.Message.Contains("天赋详情 OCR"))
{ /* inspect lastResult; add settle delay or retune talent ROIs */ } Prevention
- Add a settle delay after opening the talent detail panel.
- Keep talent title/level/bonus ROIs aligned with the current UI.
- Increase MaxOcrAttempts for transiently noisy captures.
When it happens
Trigger: The talent-title, level, or bonus ROI OCRs jitter between frames; the talent detail panel is mid-animation when sampled; `NormalizeTalentType` returns empty intermittently.
Common situations: Slow panel open animation; resolution mismatch on the talent ROIs; UI layout change moving the talent title/level/bonus regions.
Related errors
- OCR 在 次内未达到连续 次一致,最大连续次数= ,末次结果=
- 未能完整识别普通攻击、元素战技和元素爆发三个天赋。
- 武器名称 OCR 在 次内未达到连续 次一致,最大连续次数= ,末次原文= ,末次匹配=
- 图像通道数必须为3,当前为
- 无法读取分类 。
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/c2bbac975e79457d.
Report an issue: GitHub.
Appendix: source
Thrown at BetterGenshinImpact/GameTask/CharacterDevelopment/CharacterDevelopmentTask.cs:1097
{
return value;
}
}
else
{
stableValues.Reset();
lastResult = "<解析失败>";
_logger.LogDebug("角色养成识别:天赋详情 OCR 第 {Attempt}/{MaxAttempts} 次解析失败",
attempt, MaxOcrAttempts);
}
if (attempt < MaxOcrAttempts)
{
await Delay(OcrRetryDelayMilliseconds, _ct);
}
}
throw new InvalidOperationException(
$"天赋详情 OCR 在 {MaxOcrAttempts} 次内未达到连续 {RequiredStableOcrCount} 次一致," +
$"最大连续次数={stableValues.MaxConsecutiveCount},末次结果={lastResult}");
}
internal static string NormalizeTalentType(string text)
{
if (text.Contains(AttackTalentType, StringComparison.Ordinal))
{
return AttackTalentType;
}
if (text.Contains(SkillTalentType, StringComparison.Ordinal))
{
return SkillTalentType;
}
if (text.Contains(BurstTalentType, StringComparison.Ordinal))
{View on GitHub (pinned to a7cb36712d)