{"record":{"id":"e8e3557ab1a504c8","repo":"FuelLabs/sway","slug":"couldn-t-find-manifest-file-for","errorCode":null,"errorMessage":"Couldn't find manifest file for {}","messagePattern":"Couldn't find manifest file for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"forc-pkg/src/pkg.rs","lineNumber":1006,"sourceCode":"            }\n        }\n    }\n    remove\n}\n\n/// Check the validity of a node's dependency within the graph.\n///\n/// Returns the `ManifestFile` in the case that the dependency is valid.\nfn validate_dep(\n    graph: &Graph,\n    manifests: &MemberManifestFiles,\n    dep_edge: &Edge,\n    dep_node: NodeIx,\n) -> Result<PackageManifestFile> {\n    let dep_name = &dep_edge.name;\n    let node_manifest = manifests\n        .get(dep_name)\n        .ok_or_else(|| anyhow!(\"Couldn't find manifest file for {}\", dep_name))?;\n    // Check the validity of the dependency path, including its path root.\n    let dep_path = dep_path(graph, node_manifest, dep_node, manifests).map_err(|e| {\n        anyhow!(\n            \"failed to construct path for dependency {:?}: {}\",\n            dep_name,\n            e\n        )\n    })?;\n\n    // Ensure the manifest is accessible.\n    let dep_manifest = PackageManifestFile::from_dir(&dep_path)?;\n\n    // Check that the dependency's source matches the entry in the parent manifest.\n    let dep_entry = node_manifest\n        .dep(dep_name)\n        .ok_or_else(|| anyhow!(\"no entry in parent manifest\"))?;\n    let dep_source =\n        Source::from_manifest_dep_patched(node_manifest, dep_name, dep_entry, manifests)?;","sourceCodeStart":988,"sourceCodeEnd":1024,"githubUrl":"https://github.com/FuelLabs/sway/blob/47e5e902faa42baf652dd6a0c88cd23390c1a614/forc-pkg/src/pkg.rs#L988-L1024","documentation":"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.","triggerScenarios":"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.","commonSituations":"Manually renaming dependency keys in Forc.toml; partial merges of Forc.toml without Forc.lock; switching branches with divergent dependency sets.","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."],"exampleFix":"# before\nforc build   # Couldn't find manifest file for old_dep_name\n\n# after\nrm Forc.lock && forc build","handlingStrategy":"validation","validationCode":"// every lock-graph edge must be declared by some member manifest\nlet mut declared = std::collections::HashSet::new();\nfor m in member_manifests.values() {\n    for dep_name in m.dep_names() {\n        declared.insert(dep_name.to_string());\n    }\n}\nfor e in graph.edge_references() {\n    if !declared.contains(e.weight().name.as_str()) {\n        // stale lock edge: regenerate Forc.lock before building\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["graph","manifest","lock-file","dependencies"],"backgroundTag":null,"analyzedSha":"47e5e902faa42baf652dd6a0c88cd23390c1a614","analyzedAt":"2026-08-16T07:57:45.555Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}