FuelLabs/sway · error · anyhow::Error

Cannot find manifest for {}

Error message

Cannot find manifest for {}

What it means

pkg_graph_to_manifest_map looks up pkg_name in the MemberManifestFiles map (keyed by member name) and fails. Since the caller graph_to_manifest_map derives pkg_name from the same map's values, hitting this means the map's keys are inconsistent with member project.name values - in practice duplicate member names collapsing map entries, or an internal inconsistency after manifest/lock drift.

Source

Thrown at forc-pkg/src/pkg.rs:1272

    }
    Ok(manifest_map)
}

/// Given a graph of pinned packages and the project manifest, produce a map containing the
/// manifest of for every node in the graph.
///
/// Assumes the given `graph` only contains valid dependencies (see `validate_graph`).
///
/// `pkg_graph_to_manifest_map` starts from each node (which corresponds to the given proj_manifest)
/// and visits children to collect their manifest files.
fn pkg_graph_to_manifest_map(
    manifests: &MemberManifestFiles,
    pkg_name: &str,
    graph: &Graph,
) -> Result<ManifestMap> {
    let proj_manifest = manifests
        .get(pkg_name)
        .ok_or_else(|| anyhow!("Cannot find manifest for {}", pkg_name))?;
    let mut manifest_map = ManifestMap::new();

    // Traverse the graph from the project node.
    let Ok(proj_node) = find_proj_node(graph, &proj_manifest.project.name) else {
        return Ok(manifest_map);
    };
    let proj_id = graph[proj_node].id();
    manifest_map.insert(proj_id, proj_manifest.clone());

    // Resolve all parents before their dependencies as we require the parent path to construct the
    // dependency path. Skip the already added project node at the beginning of traversal.
    let mut bfs = Bfs::new(graph, proj_node);
    bfs.next(graph);
    while let Some(dep_node) = bfs.next(graph) {
        // Retrieve the parent node whose manifest is already stored.
        let (parent_manifest, dep_name) = graph
            .edges_directed(dep_node, Direction::Incoming)
            .find_map(|edge| {

View on GitHub (pinned to 47e5e902fa)

Solutions

  1. Ensure every member's [project] name is unique within the workspace.
  2. Regenerate Forc.lock (delete or 'forc update') and rebuild.
  3. If it persists on a clean lock and unique names, report to FuelLabs/sway as a forc-pkg bug.
Defensive patterns

Strategy: validation

Validate before calling

for m in member_manifests.values() {
    let name = m.project.name.clone();
    if !member_manifests.contains_key(&name) {
        return Err(format!("member map key mismatch for '{name}'; duplicate member names?"));
    }
}

Prevention

When it happens

Trigger: Two members with the same [project] name so the name-keyed map loses entries; stale Forc.lock describing a member that no longer resolves; manifest map built from a partially updated workspace.

Common situations: Duplicate member names after copy-paste; renamed members with stale lock; unusual nested workspace structures.

Related errors


AI-assisted analysis of FuelLabs/sway@47e5e902fa (2026-08-16). Data as JSON: /api/errors/5e7a0e36e46dfb70. Report an issue: GitHub.