{"record":{"id":"aa47e24282e191cc","repo":"babalae/better-genshin-impact","slug":"error-aa47e2","errorCode":null,"errorMessage":"树脂耗尽，任务结束","messagePattern":"树脂耗尽，任务结束","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"info","filePath":"BetterGenshinImpact/GameTask/AutoLeyLineOutcrop/AutoLeyLineOutcropTask.cs","lineNumber":114,"sourceCode":"\n    public AutoLeyLineOutcropTask(AutoLeyLineOutcropParam taskParam, bool oneDragonMode = false)\n    {\n        _taskParam = taskParam;\n        _oneDragonMode = oneDragonMode;\n    }\n\n    public async Task Start(CancellationToken ct)\n    {\n        _ct = ct;\n\n        try\n        {\n            Initialize();\n            EnsureMaskOverlayVisible();\n            var runTimesValue = await HandleResinExhaustionMode();\n            if (runTimesValue <= 0)\n            {\n                throw new Exception(\"树脂耗尽，任务结束\");\n            }\n\n            await PrepareForLeyLineRun();\n            await RunLeyLineChallenges();\n\n            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);","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/AutoLeyLineOutcrop/AutoLeyLineOutcropTask.cs#L96-L132","documentation":"Thrown by AutoLeyLineOutcropTask.Start when resin exhaustion mode is enabled and HandleResinExhaustionMode returns a run count of 0 or less. This means the resin calculation (CalCountByResin) determined there is no resin (original, condensed, transient, or fragile) remaining to spend on ley line challenges. The throw is intended as a normal-end signal but is thrown as a plain System.Exception rather than NormalEndException, so it is NOT caught by the 'e is NormalEndException or TaskCanceledException' filter above it — it falls through to the generic catch and gets re-wrapped as '自动地脉花执行失败'.","triggerScenarios":"User enabled '树脂耗尽模式' (resin exhaustion mode) in the ley line task settings, and when the task starts it reads the current resin count from the game screen. If total available resin yields 0 possible runs, this exception fires immediately before any navigation begins.","commonSituations":"All resin has already been spent manually or by other tasks; the resin OCR/reading step returned 0 due to a recognition failure; the game is on a screen where resin is not visible and was misread as 0; first run of the day with no condensed/fragile resin stocked.","solutions":["Check that you actually have resin (open the game and verify the resin counter).","If resin exists but was misread, ensure the game is on the main world screen where the resin counter is visible before starting the task."],"exampleFix":"// before\nif (runTimesValue <= 0)\n{\n    throw new Exception(\"树脂耗尽，任务结束\");\n}\n\n// after — use NormalEndException so the normal-end catch handles it cleanly\nif (runTimesValue <= 0)\n{\n    throw new NormalEndException(\"树脂耗尽，任务结束\");\n}","handlingStrategy":"validation","validationCode":"// Before starting, check resin availability if exhaustion mode is on\nif (_taskParam.IsResinExhaustionMode)\n{\n    var result = await CalCountByResin();\n    if (result.Count <= 0)\n    {\n        Logger.LogInformation(\"树脂已耗尽，跳过地脉花任务\");\n        return; // exit gracefully, no exception\n    }\n}","typeGuard":null,"tryCatchPattern":"// In the caller, treat resin exhaustion as a normal end\ncatch (Exception e) when (e.Message.Contains(\"树脂耗尽\"))\n{\n    Logger.LogInformation(\"树脂耗尽，任务正常结束\");\n    // do not re-throw; treat as normal completion\n}","preventionTips":["Check resin availability before starting the task in exhaustion mode.","Consider throwing NormalEndException instead of plain Exception for expected exhaustion (fix in source).","If the game screen does not show the resin counter, switch to the main world screen first."],"tags":["ley-line","resin","configuration","normal-end"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}