{"record":{"id":"c2bbac975e79457d","repo":"babalae/better-genshin-impact","slug":"ocr-maxocrattempts-requiredstabl-c2bbac","errorCode":null,"errorMessage":"天赋详情 OCR 在 {MaxOcrAttempts} 次内未达到连续 {RequiredStableOcrCount} 次一致，最大连续次数={stableValues.MaxConsecutiveCount}，末次结果={lastResult}","messagePattern":"天赋详情 OCR 在 (.+?) 次内未达到连续 (.+?) 次一致，最大连续次数=(.+?)，末次结果=(.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/CharacterDevelopment/CharacterDevelopmentTask.cs","lineNumber":1097,"sourceCode":"                {\n                    return value;\n                }\n            }\n            else\n            {\n                stableValues.Reset();\n                lastResult = \"<解析失败>\";\n                _logger.LogDebug(\"角色养成识别：天赋详情 OCR 第 {Attempt}/{MaxAttempts} 次解析失败\",\n                    attempt, MaxOcrAttempts);\n            }\n\n            if (attempt < MaxOcrAttempts)\n            {\n                await Delay(OcrRetryDelayMilliseconds, _ct);\n            }\n        }\n\n        throw new InvalidOperationException(\n            $\"天赋详情 OCR 在 {MaxOcrAttempts} 次内未达到连续 {RequiredStableOcrCount} 次一致，\" +\n            $\"最大连续次数={stableValues.MaxConsecutiveCount}，末次结果={lastResult}\");\n    }\n\n    internal static string NormalizeTalentType(string text)\n    {\n        if (text.Contains(AttackTalentType, StringComparison.Ordinal))\n        {\n            return AttackTalentType;\n        }\n\n        if (text.Contains(SkillTalentType, StringComparison.Ordinal))\n        {\n            return SkillTalentType;\n        }\n\n        if (text.Contains(BurstTalentType, StringComparison.Ordinal))\n        {","sourceCodeStart":1079,"sourceCodeEnd":1115,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/CharacterDevelopment/CharacterDevelopmentTask.cs#L1079-L1115","documentation":"`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.","triggerScenarios":"The talent-title, level, or bonus ROI OCRs jitter between frames; the talent detail panel is mid-animation when sampled; `NormalizeTalentType` returns empty intermittently.","commonSituations":"Slow panel open animation; resolution mismatch on the talent ROIs; UI layout change moving the talent title/level/bonus regions.","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."],"exampleFix":"// before\nvar detail = await ReadTalentDetailWithRetry(); // throws on jitter\n\n// after: ensure panel rendered + tuned ROIs\nawait Delay(400, _ct); // let animation settle\nvar detail = await ReadTalentDetailWithRetry();","handlingStrategy":"retry","validationCode":"// Let the talent detail panel fully render before reading;\n// confirm talent ROIs are aligned to the current layout.","typeGuard":null,"tryCatchPattern":"try { await ReadTalentDetailWithRetry(); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"天赋详情 OCR\"))\n{ /* inspect lastResult; add settle delay or retune talent ROIs */ }","preventionTips":["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."],"tags":["ocr","retry-exhausted","paddleocr","talent","stability","character-development"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}