{"record":{"id":"adfba37c57d8c8a2","repo":"babalae/better-genshin-impact","slug":"error-adfba3","errorCode":null,"errorMessage":"开启地脉花失败，已达最大重试次数","messagePattern":"开启地脉花失败，已达最大重试次数","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/AutoLeyLineOutcrop/AutoLeyLineOutcropTask.cs","lineNumber":910,"sourceCode":"        return true;\n    }\n\n    private void HandleNoStrategyFound()\n    {\n        _logger.LogError(\"未找到对应的地脉花策略\");\n        if (_taskParam.IsNotification)\n        {\n            Notify.Event(\"AutoLeyLineOutcrop\").Error(\"未找到对应的地脉花策略\");\n        }\n    }\n\n    private async Task<bool> ProcessLeyLineOutcrop(int timeoutSeconds, string targetPath, string rerunPath, bool fromTeleportStart, int retries = 0)\n    {\n        const int maxRetries = 3;\n        if (retries >= maxRetries)\n        {\n            await EnsureExitRewardPage();\n            throw new Exception(\"开启地脉花失败，已达最大重试次数\");\n        }\n\n        await Delay(500, _ct);\n        _logger.LogDebug(\"检测地脉花交互状态，重试次数: {Retries}/{MaxRetries}\", retries + 1, maxRetries);\n        using var capture = CaptureToRectArea();\n        using var ocrOverlayScope = DrawOcrOverlayScope(capture, OcrFlowOverlayKey, _ocrRo2!.RegionOfInterest, _ocrRo3!.RegionOfInterest);\n        await WaitOcrOverlayRenderTick();\n        string result1Text;\n        string result2Text;\n        var result1 = FindSafe(capture, _ocrRo2!);\n        var result2 = FindSafe(capture, _ocrRo3!);\n        result1Text = result1.Text;\n        result2Text = result2.Text;\n        _logger.LogDebug(\"OCR结果: result1='{Text1}', result2='{Text2}'\", result1Text, result2Text);\n\n        if (IsLeyLineRewardReadyState(capture, result1Text, result2Text))\n        {\n            _logger.LogDebug(\"识别到地脉花领奖状态\");","sourceCodeStart":892,"sourceCodeEnd":928,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/AutoLeyLineOutcrop/AutoLeyLineOutcropTask.cs#L892-L928","documentation":"Thrown by ProcessLeyLineOutcrop when its internal retry counter reaches maxRetries (3) without the blossom interaction succeeding. Each retry re-captures the screen, runs OCR on the two ROIs (_ocrRo2, _ocrRo3), and tries to drive the interaction; all three attempts failed.","triggerScenarios":"ProcessLeyLineOutcrop is invoked with retries >= 3 (the recursion increments retries on each failure path), so the guard at the top throws after EnsureExitRewardPage.","commonSituations":"OCR consistently fails to read the interaction/reward text; the blossom UI never appears; the character is stuck or the teleport placed it wrong; resins/desync issues.","solutions":["Ensure the character is actually at the blossom after teleporting (verify teleport/route node data).","Improve OCR conditions: resolution >= 1080p, correct language pack, no overlay covering _ocrRo2/_ocrRo3.","Increase maxRetries only if the environment is flaky, but prefer fixing the root OCR/positioning failure.","Run the task when a blossom is confirmed spawned."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"for (int attempt = 0; attempt < 2; attempt++)\n{\n    try { return await ProcessLeyLineOutcrop(timeoutSeconds, targetPath, rerunPath, fromTeleportStart); }\n    catch (Exception ex) when (ex.Message.Contains(\"已达最大重试次数\"))\n    {\n        _logger.LogWarning(\"地脉交互重试耗尽，外部第 {N} 次重试\", attempt + 1);\n        await Task.Delay(1000, _ct);\n    }\n}\nthrow new Exception(\"地脉花交互持续失败\");","preventionTips":["Ensure OCR ROIs (_ocrRo2/_ocrRo3) are unobstructed and the language pack is correct.","Confirm the character lands at the blossom after teleport.","Treat the inner 3-retry exhaustion as a signal to fix OCR/positioning, not just to retry more."],"tags":["retry","ocr","ley-line","interaction"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}