{"record":{"id":"0279c58bab0562f1","repo":"babalae/better-genshin-impact","slug":"e-message","errorCode":null,"errorMessage":"自动地脉花执行失败: {e.Message}","messagePattern":"自动地脉花执行失败: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/AutoLeyLineOutcrop/AutoLeyLineOutcropTask.cs","lineNumber":138,"sourceCode":"            if (_taskParam.IsResinExhaustionMode)\n            {\n                await RecheckResinAndContinue();\n            }\n        }\n        catch (Exception e) when (e is NormalEndException or TaskCanceledException)\n        {\n            Logger.LogInformation(\"任务结束：{Msg}\", e.Message);\n        }\n        catch (Exception e)\n        {\n            _logger.LogDebug(e, \"自动地脉花执行失败\");\n            _logger.LogError(\"自动地脉花执行失败:\" + e.Message);\n            if (_taskParam.IsNotification)\n            {\n                Notify.Event(\"AutoLeyLineOutcrop\").Error($\"任务失败: {e.Message}\");\n            }\n\n            throw new Exception($\"自动地脉花执行失败: {e.Message}\", e);\n        }\n        finally\n        {\n            try\n            {\n                try\n                {\n                    await EnsureExitRewardPage();\n                }\n                catch (Exception ex)\n                {\n                    _logger.LogDebug(ex, \"地脉花结束后尝试退出奖励界面失败\");\n                }\n\n                if (!_marksStatus)\n                {\n                    await OpenCustomMarks();\n                }","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/AutoLeyLineOutcrop/AutoLeyLineOutcropTask.cs#L120-L156","documentation":"Thrown by the outer catch-all in AutoLeyLineOutcropTask.Start. Any exception that is not a NormalEndException or TaskCanceledException, and that escapes the try block (from Initialize through RunLeyLineChallenges/RecheckResinAndContinue), is logged at Debug and Error levels, optionally pushes a notification, and is then re-thrown wrapped in a new Exception with the prefix '自动地脉花执行失败: '. The original exception is preserved as the InnerException. This is the top-level error contract for the ley line task — callers see only this wrapper.","triggerScenarios":"Any unhandled exception during the ley line task lifecycle: a FileNotFoundException for missing assets, a strategy/config validation failure, a combat failure that exceeded MaxConsecutiveFailures, a path-resolution failure, or an unexpected NullReferenceException from a vision step.","commonSituations":"The task encountered any of the specific errors in this list (245, 247-259) that were not caught as normal ends; a transient OCR failure cascaded into a null dereference; a pathing JSON file was corrupted; the game disconnected or the window closed mid-run.","solutions":["Inspect the InnerException (and the LogDebug output) to find the root cause — the wrapper message alone is not enough.","Address the specific inner error using its own documented fix (e.g. validate settings, restore missing assets, lower MaxConsecutiveFailures).","If running in a pipeline/scheduler, ensure the caller catches this wrapper and surfaces the InnerException for diagnostics.","Enable Debug logging to capture the full stack trace of the inner exception."],"exampleFix":"// before\n_logger.LogError(\"自动地脉花执行失败:\" + e.Message);\nthrow new Exception($\"自动地脉花执行失败: {e.Message}\", e);\n\n// after — preserve full inner type so callers can filter\n_logger.LogError(e, \"自动地脉花执行失败\");\nthrow new Exception($\"自动地脉花执行失败: {e.Message}\", e);","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// At the pipeline/scheduler level, catch the wrapper and inspect InnerException\ntry\n{\n    await leyLineTask.Start(ct);\n}\ncatch (Exception e) when (e.Message.StartsWith(\"自动地脉花执行失败\"))\n{\n    logger.LogError(e.InnerException, \"地脉花任务失败，根因: {Msg}\", e.InnerException?.Message);\n    Notify.Event(\"AutoLeyLineOutcrop\").Error($\"任务失败: {e.InnerException?.Message}\");\n}","preventionTips":["Always inspect the InnerException of the wrapper for the root cause.","Enable Debug-level logging to capture the full inner stack trace.","Address the specific inner error (config validation, missing assets, combat failures) rather than the wrapper."],"tags":["ley-line","error-handling","wrapper","catch-all"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}