{"record":{"id":"bc9eb47bf6c62c69","repo":"babalae/better-genshin-impact","slug":"country","errorCode":null,"errorMessage":"未找到国家 {country} 的位置信息","messagePattern":"未找到国家 (.+?) 的位置信息","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/AutoLeyLineOutcrop/AutoLeyLineOutcropTask.cs","lineNumber":826,"sourceCode":"        }\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++)\n        {\n            var pos = positions[i];\n            _logger.LogInformation(\"尝试定位地脉花: {Name}\", pos.Name ?? $\"{pos.X},{pos.Y}\");\n            await _tpTask.MoveMapTo(pos.X, pos.Y, MapTypes.Teyvat.ToString());\n            if (await LocateLeyLineOutcrop(type))","sourceCodeStart":808,"sourceCodeEnd":844,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/AutoLeyLineOutcrop/AutoLeyLineOutcropTask.cs#L808-L844","documentation":"Thrown by FindLeyLineOutcrop when the requested country key is absent from _configData.MapPositions, or its position list is empty. The routing logic needs at least one coordinate to move the map to.","triggerScenarios":"FindLeyLineOutcrop(country, type) is called with a country string that does not match any key in MapPositions, or matches a key whose List is empty (TryGetValue succeeds but positions.Count == 0).","commonSituations":"Country name typo or casing mismatch between caller and config; the region is not yet supported in the data file; the user disabled a country leaving an empty list.","solutions":["Verify the country string passed to FindLeyLineOutcrop exactly matches a key in MapPositions (mind full-width characters and exact glyphs like 蒙德/璃月/稻妻/须弥/枫丹).","Add the missing country entry with at least one position to the config/data file.","Guard the caller to only request countries known to exist in MapPositions.Keys."],"exampleFix":"// before\nif (!_configData.MapPositions.TryGetValue(country, out var positions) || positions.Count == 0)\n{\n    throw new Exception($\"未找到国家 {country} 的位置信息\");\n}\n\n// after\nif (!_configData.MapPositions.TryGetValue(country, out var positions))\n{\n    throw new ArgumentException($\"未找到国家 {country} 的位置信息。可用国家: {string.Join(\", \", _configData.MapPositions.Keys)}\", nameof(country));\n}\nif (positions.Count == 0)\n{\n    throw new InvalidOperationException($\"国家 {country} 的位置列表为空\");\n}","handlingStrategy":"validation","validationCode":"if (!_configData.MapPositions.ContainsKey(country) || _configData.MapPositions[country].Count == 0)\n{\n    throw new ArgumentException($\"国家 {country} 无位置信息。可用: {string.Join(\", \", _configData.MapPositions.Keys)}\", nameof(country));\n}","typeGuard":"bool CountryAvailable(LeyLineConfig c, string country) => c.MapPositions.TryGetValue(country, out var p) && p.Count > 0;","tryCatchPattern":null,"preventionTips":["Drive country selection from _configData.MapPositions.Keys so only valid keys are requested.","Normalize country strings (trim, full-width checks) before lookup.","Log available keys when a lookup fails to speed diagnosis."],"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"}