{"record":{"id":"16db72b8304a3f3d","repo":"babalae/better-genshin-impact","slug":"error-16db72","errorCode":null,"errorMessage":"地脉花策略配置缺失","messagePattern":"地脉花策略配置缺失","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/AutoLeyLineOutcrop/AutoLeyLineOutcropTask.cs","lineNumber":378,"sourceCode":"            {\n                // Manual flow: detect the ley line on the big map.\n                await FindLeyLineOutcrop(_taskParam.Country, _taskParam.LeyLineOutcropType);\n            }\n\n            var foundStrategy = await ExecuteMatchingStrategy();\n            if (!foundStrategy)\n            {\n                HandleNoStrategyFound();\n                return;\n            }\n        }\n    }\n\n    private async Task<bool> ExecuteMatchingStrategy()\n    {\n        if (_configData?.LeyLinePositions == null)\n        {\n            throw new Exception(\"地脉花策略配置缺失\");\n        }\n\n        if (!_configData.LeyLinePositions.TryGetValue(_taskParam.Country, out var positions))\n        {\n            return false;\n        }\n\n        foreach (var position in positions)\n        {\n            if (IsNearPosition(_leyLineX, _leyLineY, position.X, position.Y, _configData.ErrorThreshold))\n            {\n                _logger.LogInformation(\"匹配策略: {Strategy} order={Order}\", position.Strategy, position.Order);\n                await ExecutePathsUsingNodeData(position);\n                return true;\n            }\n        }\n\n        return false;","sourceCodeStart":360,"sourceCodeEnd":396,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/AutoLeyLineOutcrop/AutoLeyLineOutcropTask.cs#L360-L396","documentation":"Thrown by ExecuteMatchingStrategy when _configData is null or _configData.LeyLinePositions is null. ExecuteMatchingStrategy is called after FindLeyLineOutcropByBook/FindLeyLineOutcrop to match the detected ley line coordinates against known positions and select a strategy. If the config was never loaded (LoadConfigData failed silently or _configData was not populated) or the loaded config lacks the LeyLinePositions dictionary, strategy matching is impossible.","triggerScenarios":"Called from RunLeyLineChallenges after a ley line is located on the map. Fires when LoadConfigData did not run or produced a config without LeyLinePositions. This can happen if config.json was loaded but the LeyLinePositions property was missing/null in the JSON (System.Text.Json leaves it null rather than failing), or if _configData was somehow cleared between load and use.","commonSituations":"config.json exists and parses but is missing the LeyLinePositions section (schema mismatch after an update); LoadConfigData threw and was caught somewhere, leaving _configData null; the config was hand-edited and the LeyLinePositions object was accidentally deleted.","solutions":["Verify config.json contains a non-null LeyLinePositions object with entries for each supported country.","Restore config.json from the bundled/default version.","If the schema changed, replace the config with the version matching the current code.","Add a post-load validation in LoadConfigData to fail early with a clearer message if LeyLinePositions is null."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// After LoadConfigData, verify LeyLinePositions is populated\nif (_configData?.LeyLinePositions == null)\n{\n    Logger.LogError(\"地脉花策略配置缺失，请检查 config.json\");\n    throw new NormalEndException(\"配置文件缺少 LeyLinePositions 数据\");\n}","typeGuard":"public static bool HasLeyLinePositions(AutoLeyLineConfigData? config)\n{\n    return config?.LeyLinePositions != null && config.LeyLinePositions.Count > 0;\n}","tryCatchPattern":null,"preventionTips":["After loading config.json, validate that LeyLinePositions is non-null and contains entries.","Restore config.json from the bundled version if sections are missing.","Add a schema validation step after deserialization."],"tags":["ley-line","configuration","null-check","strategy"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}