babalae/better-genshin-impact · warning · NormalEndException

首次伐木就未识别到木材数据,已经自动关闭【OCR识别并累计木材数】的功能,请重新启动【自动伐木】功能!

Error message

首次伐木就未识别到木材数据,已经自动关闭【OCR识别并累计木材数】的功能,请重新启动【自动伐木】功能!

What it means

Thrown as NormalEndException by PrintWoodStatistics when OCR returns empty wood statistics text AND _woodMetricsDict is still empty (first attempt). This is treated as a configuration/setup failure: the OCR feature is auto-disabled (WoodCountOcrEnabled = false) and the auto-wood task is terminated gracefully. NormalEndException signals a user-facing 'normal end' rather than a crash.

Source

Thrown at BetterGenshinImpact/GameTask/AutoWood/AutoWoodTask.cs:177

        [GeneratedRegex("([^\\d\\n]+)[×x](\\d+)")]
        private static partial Regex _parseWoodStatisticsRegex();

        public bool WoodStatisticsAlwaysEmpty()
        {
            return NothingCount >= 3;
        }

        public void PrintWoodStatistics(WoodTaskParam taskParam)
        {
            var woodStatisticsText = GetWoodStatisticsText(taskParam);
            if (string.IsNullOrEmpty(woodStatisticsText))
            {
                NothingCount++;
                Logger.LogWarning("未能识别到伐木的统计数据");
                if (_woodMetricsDict.Count == 0)
                {
                    TaskContext.Instance().Config.AutoWoodConfig.WoodCountOcrEnabled = false;
                    throw new NormalEndException("首次伐木就未识别到木材数据,已经自动关闭【OCR识别并累计木材数】的功能,请重新启动【自动伐木】功能!");
                }

                return;
            }

            ParseWoodStatisticsText(taskParam, woodStatisticsText);
            CheckAndPrintWoodQuantities(taskParam);
        }

        private string GetWoodStatisticsText(WoodTaskParam taskParam)
        {
            var firstOcrResultList = new List<string>();
            // 创建一个计时器,循环识别文本,直到超时
            var stopwatch = Stopwatch.StartNew();
            while (stopwatch.ElapsedMilliseconds < 3500)
            {
                // OCR识别木材文本
                var recognizedText = WoodTextAreaOcr();

View on GitHub (pinned to a7cb36712d)

Solutions

  1. Restart the AutoWood feature after the OCR toggle is reset (the exception message says to restart).
  2. Verify PaddleOCR models are correctly installed and the OCR engine initializes without errors.
  3. Check the wood-count text area crop rect matches the current game resolution and scaling.
  4. Ensure wood cutting is actually happening (trees nearby, gadget working) so the counter appears.
  5. Confirm the game language matches the expected OCR language.
Defensive patterns

Strategy: try-catch

Try / catch

try
{
    woodCollector.PrintWoodStatistics(taskParam);
}
catch (NormalEndException ex)
{
    // NormalEndException signals graceful task termination, not a crash
    Logger.LogWarning(ex.Message);
    // The OCR feature has been auto-disabled; inform user to restart AutoWood
}

Prevention

When it happens

Trigger: Called from PrintWoodStatistics(taskParam). GetWoodStatisticsText returns empty/null, NothingCount increments, and _woodMetricsDict.Count == 0. The config flag WoodCountOcrEnabled is set to false and NormalEndException is thrown.

Common situations: OCR engine (PaddleOCR) failed to initialize or models not loaded; the wood-count text area rect is misconfigured for the current resolution; game UI elements (wood counter) not visible because wood cutting hasn't actually started; the game language or UI theme differs from expected.

Related errors


AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13). Data as JSON: /api/errors/a06aa116d248252a. Report an issue: GitHub.