babalae/better-genshin-impact · critical · FileNotFoundException

LeyLineOutcropData.json 未找到

Error message

LeyLineOutcropData.json 未找到

What it means

Thrown as a FileNotFoundException by LoadNodeData when the file GameTask/AutoLeyLineOutcrop/Assets/LeyLineOutcropData.json does not exist. This file contains the teleport/blossom node graph (nodes, positions, and edges with route references) that the path-finding logic (FindPathsToTarget, FindReversePathsIfNeeded) uses to compute navigation routes. It is a bundled asset; its absence means the entire node-based navigation system cannot function.

Source

Thrown at BetterGenshinImpact/GameTask/AutoLeyLineOutcrop/AutoLeyLineOutcropTask.cs:759

    private static PathingPartyConfig BuildLeyLinePathingPartyConfig()
    {
        var partyConfig = PathingPartyConfig.BuildDefault();
        partyConfig.SkipPartySwitch = true;
        return partyConfig;
    }

    private async Task<NodeData> LoadNodeData()
    {
        if (_nodeData != null)
        {
            return _nodeData;
        }

        var workDir = Global.Absolute(@"GameTask\AutoLeyLineOutcrop");
        var nodePath = Path.Combine(workDir, "Assets", "LeyLineOutcropData.json");
        if (!File.Exists(nodePath))
        {
            throw new FileNotFoundException("LeyLineOutcropData.json 未找到", nodePath);
        }

        var raw = JsonSerializer.Deserialize<RawNodeData>(File.ReadAllText(nodePath))
                  ?? throw new Exception("节点数据解析失败");
        _nodeData = AdaptNodeData(raw);
        return _nodeData;
    }

    private static NodeData AdaptNodeData(RawNodeData raw)
    {
        var nodes = new List<Node>();
        foreach (var teleport in raw.Teleports)
        {
            nodes.Add(new Node
            {
                Id = teleport.Id,
                Region = teleport.Region,
                Position = teleport.Position,

View on GitHub (pinned to a7cb36712d)

Solutions

  1. Reinstall the application to restore the bundled Assets/LeyLineOutcropData.json file.
  2. If building from source, verify the file is marked as CopyToOutputDirectory in the .csproj.
  3. Check antivirus quarantine history and restore/exclude the file.
  4. Verify the file exists at Global.Absolute(@"GameTask\AutoLeyLineOutcrop\Assets\LeyLineOutcropData.json").
Defensive patterns

Strategy: validation

Validate before calling

// Before loading node data, verify the file exists
var nodePath = Path.Combine(Global.Absolute(@"GameTask\AutoLeyLineOutcrop"), "Assets", "LeyLineOutcropData.json");
if (!File.Exists(nodePath))
{
    Logger.LogError("LeyLineOutcropData.json 不存在,请重新安装程序: {Path}", nodePath);
    return;
}

Try / catch

catch (FileNotFoundException ex) when (ex.Message.Contains("LeyLineOutcropData.json 未找到"))
{
    logger.LogError("节点数据文件缺失,请重新安装程序: {Path}", ex.FileName);
    ThemedMessageBox.Error("节点数据文件缺失,请重新安装程序", "文件未找到");
}

Prevention

When it happens

Trigger: LoadNodeData (called from ExecutePathsUsingNodeData via ExecuteMatchingStrategy) resolves the path via Global.Absolute and checks File.Exists. Fires when the deployment is missing Assets/LeyLineOutcropData.json. The method caches the result in _nodeData so this only fires once per task run.

Common situations: Incomplete installation missing the node data file; antivirus quarantine; a refactor moved/renamed the file without updating the path; a build/packaging step excluded the JSON from output; running from source without the Assets directory populated.

Related errors


AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13). Data as JSON: /api/errors/383491fad6290727. Report an issue: GitHub.