{"record":{"id":"87e779dc84157849","repo":"babalae/better-genshin-impact","slug":"error-87e779","errorCode":null,"errorMessage":"战斗策略文件不存在","messagePattern":"战斗策略文件不存在","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/AutoLeyLineOutcrop/AutoLeyLineOutcropTask.cs","lineNumber":1310,"sourceCode":"        {\n            fightConfig.CopyFromAutoFightConfig(globalAutoFightConfig);\n        }\n\n        if (fightConfig.Timeout <= 0)\n        {\n            fightConfig.Timeout = _taskParam.Timeout > 0 ? _taskParam.Timeout : Math.Max(globalAutoFightConfig.Timeout, 1);\n        }\n\n        _taskParam.Timeout = fightConfig.Timeout;\n        return fightConfig.ToAutoFightConfig();\n    }\n\n    private static string BuildAutoFightStrategyPath(AutoFightConfig config)\n    {\n        var (path, _) = AutoFightParam.ResolveStrategyPath(config.StrategyName);\n        if (!File.Exists(path) && !Directory.Exists(path))\n        {\n            throw new Exception(\"战斗策略文件不存在\");\n        }\n\n        return path;\n    }\n\n    private async Task<bool> RecognizeTextInRegion(int timeoutMs)\n    {\n        var start = DateTime.UtcNow;\n        var noTextCount = 0;\n        var fightTextDetectedAt = DateTime.MinValue;\n        var lastSeekAssistAt = DateTime.MinValue;\n        var seekEnemyEnabled = _taskParam.FightConfig.SeekEnemyEnabled;\n        var seekEnemyInterval = TimeSpan.FromSeconds(Math.Clamp(_taskParam.FightConfig.SeekEnemyIntervalSeconds, 1, 60));\n        var seekEnemyRotaryFactor = Math.Clamp(_taskParam.FightConfig.SeekEnemyRotaryFactor, 1, 13);\n        var successKeywords = new[] { \"挑战达成\", \"战斗胜利\", \"挑战成功\" };\n        var failureKeywords = new[] { \"挑战失败\" };\n\n        while ((DateTime.UtcNow - start).TotalMilliseconds < timeoutMs)","sourceCodeStart":1292,"sourceCodeEnd":1328,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/AutoLeyLineOutcrop/AutoLeyLineOutcropTask.cs#L1292-L1328","documentation":"Thrown by BuildAutoFightStrategyPath after AutoFightParam.ResolveStrategyPath(config.StrategyName) returns a path that is neither an existing file nor an existing directory. The combat strategy referenced by the config is not on disk.","triggerScenarios":"A fight config with a non-empty StrategyName is resolved to a path; File.Exists(path) and Directory.Exists(path) are both false → throw.","commonSituations":"The named strategy was deleted/renamed; a fresh install is missing the default strategy files under User\\AutoFight; StrategyName points to a path that was never created.","solutions":["Confirm the strategy file exists at the resolved path (print ResolveStrategyPath output).","Reinstall/restore the default combat strategy files under User\\AutoFight.","Correct StrategyName in the config to a strategy that exists.","Switch to '根据队伍自动选择' to use the directory-based auto selection."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"var (path, _) = AutoFightParam.ResolveStrategyPath(config.StrategyName);\nif (!File.Exists(path) && !Directory.Exists(path))\n{\n    throw new FileNotFoundException($\"战斗策略文件不存在: {path}\", path);\n}","typeGuard":"bool StrategyExists(string strategyName)\n{\n    var (p, _) = AutoFightParam.ResolveStrategyPath(strategyName);\n    return File.Exists(p) || Directory.Exists(p);\n}","tryCatchPattern":null,"preventionTips":["Validate strategy paths at config-load time, not at fight time.","Ship default strategies under User\\\\AutoFight and verify them in CI.","Prefer '根据队伍自动选择' when a named strategy is missing."],"tags":["config","file","combat","strategy"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}