babalae/better-genshin-impact · error · Exception

没有可用路径

Error message

没有可用路径

What it means

Thrown by SelectOptimalPath when the paths list passed to it is empty. SelectOptimalPath is a static method that picks the path with the fewest route segments from a list of candidate paths produced by FindPathsToTarget (BFS over the node graph) plus FindReversePathsIfNeeded. An empty list means there is no route in the node graph from any teleport node to the target ley line blossom node — neither a forward path nor a reverse/teleport-hop fallback.

Source

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

                }

                reversePaths.Add(new PathInfo
                {
                    StartNode = teleportNode,
                    TargetNode = targetNode,
                    Routes = [route.Route, nextRoute.Route]
                });
            }
        }

        return reversePaths;
    }

    private static PathInfo SelectOptimalPath(List<PathInfo> paths)
    {
        if (paths.Count == 0)
        {
            throw new Exception("没有可用路径");
        }

        return paths.OrderBy(p => p.Routes.Count).First();
    }

    private async Task ExecutePath(PathInfo path)
    {
        foreach (var routePath in path.Routes)
        {
            await RunPathingFile(routePath);
        }

        var lastRoute = path.Routes.Last();
        var targetRoute = BuildTargetRoute(lastRoute);
        var rerunRoute = BuildRerunRoute(lastRoute);
        var fromTeleportStart = "teleport".Equals(path.StartNode.Type, StringComparison.OrdinalIgnoreCase);
        await ProcessLeyLineOutcrop(_taskParam.FightConfig.Timeout, targetRoute, rerunRoute, fromTeleportStart);

View on GitHub (pinned to a7cb36712d)

Solutions

  1. Update LeyLineOutcropData.json with the correct edges connecting a teleport node to the target blossom node.
  2. Verify the route JSON files referenced in the edges exist under assets/pathing/.
  3. If the ley line position is new, add the corresponding node and edges to the data file.
  4. Fall back to the handbook-based navigation mode if the node graph is incomplete for this region.
Defensive patterns

Strategy: validation

Validate before calling

// Before calling SelectOptimalPath, verify paths are non-empty
var paths = FindPathsToTarget(nodeData, targetNode);
if (paths.Count == 0)
{
    Logger.LogWarning("未找到从传送点到地脉花的路径,跳过此位置");
    await EnsureExitRewardPage();
    return; // skip this position instead of throwing
}

Try / catch

catch (Exception ex) when (ex.Message.Contains("没有可用路径"))
{
    logger.LogWarning(ex, "节点图中无可用路径,尝试下一条地脉花");
    await EnsureExitRewardPage();
    continue; // try the next ley line position
}

Prevention

When it happens

Trigger: Called from ExecutePathsUsingNodeData after FindPathsToTarget and FindReversePathsIfNeeded both returned empty. This means the LeyLineOutcropData.json node graph has no edges connecting any teleport to the target blossom, or the target node's Next/Prev lists are empty.

Common situations: LeyLineOutcropData.json is missing edges for a specific ley line position; the node graph data is outdated and does not cover a newly discovered blossom location; the target node was found by position but has no graph connectivity; the route JSON files referenced by edges are missing or misnamed.

Related errors


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