babalae/better-genshin-impact · error · Exception

路径文件解析失败

Error message

路径文件解析失败

What it means

Thrown by RunPathingFile when PathingTask.BuildFromFilePath returns null for the given route file path. BuildFromFilePath reads a pathing JSON file and constructs a PathingTask object; it returns null if the file does not exist, cannot be read, or fails JSON deserialization. RunPathingFile is called for each route segment in a PathInfo, so this error means a specific route file referenced by the node graph could not be loaded.

Source

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

    }

    private bool PathingFileExists(string routePath)
    {
        var workDir = Global.Absolute(@"GameTask\AutoLeyLineOutcrop");
        var localPath = routePath.Replace("/", Path.DirectorySeparatorChar.ToString());
        var fullPath = Path.Combine(workDir, localPath);
        return File.Exists(fullPath);
    }

    private async Task RunPathingFile(string routePath)
    {
        await _returnMainUiTask.Start(_ct);

        var workDir = Global.Absolute(@"GameTask\AutoLeyLineOutcrop");
        var localPath = routePath.Replace("/", Path.DirectorySeparatorChar.ToString());
        var fullPath = Path.Combine(workDir, localPath);

        var task = PathingTask.BuildFromFilePath(fullPath) ?? throw new Exception("路径文件解析失败");
        var executor = new PathExecutor(_ct);
        executor.PartyConfig = BuildLeyLinePathingPartyConfig();
        await executor.Pathing(task);
    }

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

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

View on GitHub (pinned to a7cb36712d)

Solutions

  1. Check the fullPath in the exception context to identify which route file failed.
  2. Verify the route JSON file exists at the expected path under GameTask/AutoLeyLineOutcrop/assets/pathing/.
  3. Ensure route file names in LeyLineOutcropData.json match the actual files (including case).
  4. Reinstall or rebuild to restore missing route JSON files.
  5. If the path was generated by BuildTargetRoute/BuildRerunRoute, verify the base route path string has the expected format (assets/pathing/ prefix).
Defensive patterns

Strategy: validation

Validate before calling

// Before calling PathingTask.BuildFromFilePath, verify the file exists
var fullPath = Path.Combine(workDir, localPath);
if (!File.Exists(fullPath))
{
    Logger.LogError("路径文件不存在: {Path}", fullPath);
    return; // skip this route
}

Try / catch

catch (Exception ex) when (ex.Message.Contains("路径文件解析失败"))
{
    logger.LogError(ex, "路径文件解析失败: {Path}", routePath);
    await EnsureExitRewardPage();
    continue; // skip to next route/ley line
}

Prevention

When it happens

Trigger: RunPathingFile resolves fullPath under GameTask/AutoLeyLineOutcrop and calls PathingTask.BuildFromFilePath. Fires when the route JSON (e.g. assets/pathing/target/some_route.json or a rerun variant) is missing, empty, or malformed. The route path is derived from BuildTargetRoute/BuildRerunRoute which transform the base route path string.

Common situations: A route JSON file was not included in the build/install; the route file name in LeyLineOutcropData.json does not match the actual file on disk (case sensitivity on some file systems); the route JSON is corrupted or has an incompatible schema after a version update; the -rerun or target/ path transformation produced a path that does not exist.

Related errors


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