FuelLabs/sway · error
Couldn't find manifest file for {}
Error message
Couldn't find manifest file for {} What it means
During validate_dep the dependency's name is looked up in the MemberManifestFiles map (BTreeMap keyed by member package name) and is absent. The lock-derived graph contains an edge/node whose package is not known to any loaded member manifest - the lock and the manifest set have drifted apart.
Source
Thrown at forc-pkg/src/pkg.rs:1006
}
}
}
remove
}
/// Check the validity of a node's dependency within the graph.
///
/// Returns the `ManifestFile` in the case that the dependency is valid.
fn validate_dep(
graph: &Graph,
manifests: &MemberManifestFiles,
dep_edge: &Edge,
dep_node: NodeIx,
) -> Result<PackageManifestFile> {
let dep_name = &dep_edge.name;
let node_manifest = manifests
.get(dep_name)
.ok_or_else(|| anyhow!("Couldn't find manifest file for {}", dep_name))?;
// Check the validity of the dependency path, including its path root.
let dep_path = dep_path(graph, node_manifest, dep_node, manifests).map_err(|e| {
anyhow!(
"failed to construct path for dependency {:?}: {}",
dep_name,
e
)
})?;
// Ensure the manifest is accessible.
let dep_manifest = PackageManifestFile::from_dir(&dep_path)?;
// Check that the dependency's source matches the entry in the parent manifest.
let dep_entry = node_manifest
.dep(dep_name)
.ok_or_else(|| anyhow!("no entry in parent manifest"))?;
let dep_source =
Source::from_manifest_dep_patched(node_manifest, dep_name, dep_entry, manifests)?;View on GitHub (pinned to 47e5e902fa)
Solutions
- Regenerate the lock: delete Forc.lock (or run 'forc update') and rebuild.
- Verify every [dependencies]/[contract-dependencies]/[patch] name in member manifests resolves to an actual package.
- Commit Forc.toml and Forc.lock together so they never drift.
Example fix
# before forc build # Couldn't find manifest file for old_dep_name # after rm Forc.lock && forc build
Defensive patterns
Strategy: validation
Validate before calling
// every lock-graph edge must be declared by some member manifest
let mut declared = std::collections::HashSet::new();
for m in member_manifests.values() {
for dep_name in m.dep_names() {
declared.insert(dep_name.to_string());
}
}
for e in graph.edge_references() {
if !declared.contains(e.weight().name.as_str()) {
// stale lock edge: regenerate Forc.lock before building
}
} Prevention
- Never edit dependency names in Forc.toml without rebuilding/regenerating the lock.
- Review 'git diff Forc.lock' alongside 'git diff Forc.toml' in code review.
When it happens
Trigger: Forc.lock still contains a package edge for a dependency that was renamed or removed from every Forc.toml; a patch redirect moved a name; manifests were edited while the lock was not regenerated; hand-edited lock entries.
Common situations: Manually renaming dependency keys in Forc.toml; partial merges of Forc.toml without Forc.lock; switching branches with divergent dependency sets.
Related errors
- lock file did not match manifest
- graph contains no project node
- no entry in parent manifest
- Failed to find path root: `path` dependency \"{}\" has no pa
- the dependency `{}` could not be found in `{}`
AI-assisted analysis of FuelLabs/sway@47e5e902fa (2026-08-16).
Data as JSON: /api/errors/e8e3557ab1a504c8.
Report an issue: GitHub.