babalae/better-genshin-impact · error · Exception
开启地脉花失败,已达最大重试次数
Error message
开启地脉花失败,已达最大重试次数
What it means
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.
Source
Thrown at BetterGenshinImpact/GameTask/AutoLeyLineOutcrop/AutoLeyLineOutcropTask.cs:910
return true;
}
private void HandleNoStrategyFound()
{
_logger.LogError("未找到对应的地脉花策略");
if (_taskParam.IsNotification)
{
Notify.Event("AutoLeyLineOutcrop").Error("未找到对应的地脉花策略");
}
}
private async Task<bool> ProcessLeyLineOutcrop(int timeoutSeconds, string targetPath, string rerunPath, bool fromTeleportStart, int retries = 0)
{
const int maxRetries = 3;
if (retries >= maxRetries)
{
await EnsureExitRewardPage();
throw new Exception("开启地脉花失败,已达最大重试次数");
}
await Delay(500, _ct);
_logger.LogDebug("检测地脉花交互状态,重试次数: {Retries}/{MaxRetries}", retries + 1, maxRetries);
using var capture = CaptureToRectArea();
using var ocrOverlayScope = DrawOcrOverlayScope(capture, OcrFlowOverlayKey, _ocrRo2!.RegionOfInterest, _ocrRo3!.RegionOfInterest);
await WaitOcrOverlayRenderTick();
string result1Text;
string result2Text;
var result1 = FindSafe(capture, _ocrRo2!);
var result2 = FindSafe(capture, _ocrRo3!);
result1Text = result1.Text;
result2Text = result2.Text;
_logger.LogDebug("OCR结果: result1='{Text1}', result2='{Text2}'", result1Text, result2Text);
if (IsLeyLineRewardReadyState(capture, result1Text, result2Text))
{
_logger.LogDebug("识别到地脉花领奖状态");View on GitHub (pinned to a7cb36712d)
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.
Defensive patterns
Strategy: retry
Try / catch
for (int attempt = 0; attempt < 2; attempt++)
{
try { return await ProcessLeyLineOutcrop(timeoutSeconds, targetPath, rerunPath, fromTeleportStart); }
catch (Exception ex) when (ex.Message.Contains("已达最大重试次数"))
{
_logger.LogWarning("地脉交互重试耗尽,外部第 {N} 次重试", attempt + 1);
await Task.Delay(1000, _ct);
}
}
throw new Exception("地脉花交互持续失败"); Prevention
- 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.
When it happens
Trigger: ProcessLeyLineOutcrop is invoked with retries >= 3 (the recursion increments retries on each failure path), so the guard at the top throws after EnsureExitRewardPage.
Common situations: 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.
Related errors
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/adfba37c57d8c8a2.
Report an issue: GitHub.