{"record":{"id":"a06aa116d248252a","repo":"babalae/better-genshin-impact","slug":"ocr-a06aa1","errorCode":null,"errorMessage":"首次伐木就未识别到木材数据，已经自动关闭【OCR识别并累计木材数】的功能，请重新启动【自动伐木】功能！","messagePattern":"首次伐木就未识别到木材数据，已经自动关闭【OCR识别并累计木材数】的功能，请重新启动【自动伐木】功能！","errorType":"exception","errorClass":"NormalEndException","httpStatus":null,"severity":"warning","filePath":"BetterGenshinImpact/GameTask/AutoWood/AutoWoodTask.cs","lineNumber":177,"sourceCode":"        [GeneratedRegex(\"([^\\\\d\\\\n]+)[×x](\\\\d+)\")]\n        private static partial Regex _parseWoodStatisticsRegex();\n\n        public bool WoodStatisticsAlwaysEmpty()\n        {\n            return NothingCount >= 3;\n        }\n\n        public void PrintWoodStatistics(WoodTaskParam taskParam)\n        {\n            var woodStatisticsText = GetWoodStatisticsText(taskParam);\n            if (string.IsNullOrEmpty(woodStatisticsText))\n            {\n                NothingCount++;\n                Logger.LogWarning(\"未能识别到伐木的统计数据\");\n                if (_woodMetricsDict.Count == 0)\n                {\n                    TaskContext.Instance().Config.AutoWoodConfig.WoodCountOcrEnabled = false;\n                    throw new NormalEndException(\"首次伐木就未识别到木材数据，已经自动关闭【OCR识别并累计木材数】的功能，请重新启动【自动伐木】功能！\");\n                }\n\n                return;\n            }\n\n            ParseWoodStatisticsText(taskParam, woodStatisticsText);\n            CheckAndPrintWoodQuantities(taskParam);\n        }\n\n        private string GetWoodStatisticsText(WoodTaskParam taskParam)\n        {\n            var firstOcrResultList = new List<string>();\n            // 创建一个计时器，循环识别文本，直到超时\n            var stopwatch = Stopwatch.StartNew();\n            while (stopwatch.ElapsedMilliseconds < 3500)\n            {\n                // OCR识别木材文本\n                var recognizedText = WoodTextAreaOcr();","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/AutoWood/AutoWoodTask.cs#L159-L195","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Restart the AutoWood feature after the OCR toggle is reset (the exception message says to restart).","Verify PaddleOCR models are correctly installed and the OCR engine initializes without errors.","Check the wood-count text area crop rect matches the current game resolution and scaling.","Ensure wood cutting is actually happening (trees nearby, gadget working) so the counter appears.","Confirm the game language matches the expected OCR language."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try\n{\n    woodCollector.PrintWoodStatistics(taskParam);\n}\ncatch (NormalEndException ex)\n{\n    // NormalEndException signals graceful task termination, not a crash\n    Logger.LogWarning(ex.Message);\n    // The OCR feature has been auto-disabled; inform user to restart AutoWood\n}","preventionTips":["Verify PaddleOCR models are correctly installed before starting AutoWood.","Ensure the wood-count text area crop matches the current game resolution.","Confirm wood cutting is actually producing visible counters before OCR runs.","Restart the AutoWood feature after this exception as the message instructs."],"tags":["auto-wood","ocr","normal-end","config-disable"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}