{"record":{"id":"37d6412b78f055b0","repo":"babalae/better-genshin-impact","slug":"error-37d641","errorCode":null,"errorMessage":"地图位置配置缺失","messagePattern":"地图位置配置缺失","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/AutoLeyLineOutcrop/AutoLeyLineOutcropTask.cs","lineNumber":821,"sourceCode":"                continue;\n            }\n\n            sourceNode.Next.Add(new NodeRoute { Target = edge.Target, Route = edge.Route });\n            targetNode.Prev.Add(edge.Source);\n        }\n\n        return new NodeData\n        {\n            Nodes = nodes,\n            Indexes = raw.Indexes\n        };\n    }\n\n    private async Task FindLeyLineOutcrop(string country, string type)\n    {\n        if (_configData?.MapPositions == null)\n        {\n            throw new Exception(\"地图位置配置缺失\");\n        }\n\n        if (!_configData.MapPositions.TryGetValue(country, out var positions) || positions.Count == 0)\n        {\n            throw new Exception($\"未找到国家 {country} 的位置信息\");\n        }\n\n        await _returnMainUiTask.Start(_ct);\n        await _tpTask.OpenBigMapUi();\n\n        await _tpTask.MoveMapTo(positions[0].X, positions[0].Y, MapTypes.Teyvat.ToString());\n        var found = await LocateLeyLineOutcrop(type);\n        if (found)\n        {\n            return;\n        }\n\n        for (var i = 1; i < positions.Count; i++)","sourceCodeStart":803,"sourceCodeEnd":839,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/AutoLeyLineOutcrop/AutoLeyLineOutcropTask.cs#L803-L839","documentation":"Thrown by FindLeyLineOutcrop when _configData is null or _configData.MapPositions is null. The runtime ley-line configuration that maps each country to candidate map coordinates was never loaded, so the task cannot decide where to look.","triggerScenarios":"FindLeyLineOutcrop(country, type) runs before the ley-line config (containing MapPositions) has been initialized, or the config object failed to deserialize its MapPositions member.","commonSituations":"Task started without loading the ley-line config; config file missing or the MapPositions section removed; a code path skipped the LoadConfig step.","solutions":["Ensure the ley-line configuration is loaded and its MapPositions dictionary is populated before invoking the task.","Check the config file on disk has a valid MapPositions section; restore defaults if absent.","If MapPositions is optional in your build, provide a fallback/default mapping instead of throwing."],"exampleFix":"// before\nif (_configData?.MapPositions == null)\n{\n    throw new Exception(\"地图位置配置缺失\");\n}\n\n// after\nif (_configData is null || _configData.MapPositions is null || _configData.MapPositions.Count == 0)\n{\n    throw new InvalidOperationException(\"地图位置配置缺失：请确认地脉配置已加载且包含 MapPositions\");\n}","handlingStrategy":"validation","validationCode":"if (_configData is null || _configData.MapPositions is null)\n{\n    throw new InvalidOperationException(\"地脉配置未加载或缺少 MapPositions，请先加载配置\");\n}","typeGuard":"bool HasMapPositions(LeyLineConfig? c) => c?.MapPositions is { Count: > 0 };","tryCatchPattern":null,"preventionTips":["Load and assert the ley-line config (with MapPositions) at task start, before any FindLeyLineOutcrop call.","Unit-test config deserialization to guarantee MapPositions is populated.","Fail fast at startup rather than mid-task."],"tags":["config","validation","ley-line"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}