{"record":{"id":"23f5f4a1e91341a1","repo":"FuelLabs/sway","slug":"cannot-find-dependency-in-the-workspace","errorCode":null,"errorMessage":"cannot find dependency in the workspace","messagePattern":"cannot find dependency in the workspace","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"forc-pkg/src/pkg.rs","lineNumber":1115,"sourceCode":"                            }\n                        }\n                    }\n                }\n            }\n\n            bail!(\n                \"no dependency or patch with name {:?} in manifest of {:?}\",\n                dep_name,\n                node_manifest.project.name\n            )\n        }\n        source::DependencyPath::Member => {\n            // If a node has a root dependency it is a member of the workspace.\n            manifests\n                .values()\n                .find(|manifest| manifest.project.name == *dep_name)\n                .map(|manifest| manifest.path().to_path_buf())\n                .ok_or_else(|| anyhow!(\"cannot find dependency in the workspace\"))\n        }\n    }\n}\n\n/// Remove the given set of dependency edges from the `graph`.\n///\n/// Also removes all nodes that are no longer connected to any root node as a result.\nfn remove_deps(\n    graph: &mut Graph,\n    member_names: &HashSet<String>,\n    edges_to_remove: &BTreeSet<EdgeIx>,\n) {\n    // Retrieve the project nodes for workspace members.\n    let member_nodes: HashSet<_> = member_nodes(graph)\n        .filter(|&n| member_names.contains(&graph[n].name.to_string()))\n        .collect();\n\n    // Before removing edges, sort the nodes in order of dependency for the node removal pass.","sourceCodeStart":1097,"sourceCodeEnd":1133,"githubUrl":"https://github.com/FuelLabs/sway/blob/47e5e902faa42baf652dd6a0c88cd23390c1a614/forc-pkg/src/pkg.rs#L1097-L1133","documentation":"dep_path classified the dependency as DependencyPath::Member - the node is expected to be a workspace member - but scanning manifests.values() found no member whose project.name equals the dependency name. The member is missing, renamed, or was never loaded into MemberManifestFiles.","triggerScenarios":"A Forc.toml [dependencies] entry uses a name that differs from the member's actual [project] name (including casing); the member directory was removed but still referenced; the member dir is not listed in [workspace] members so its manifest was never loaded.","commonSituations":"Renaming a member package without updating the dependents' dependency keys; adding a new member folder but forgetting the members entry; name typos between dependency key and member name.","solutions":["Make the dependency key exactly equal the member's [project] name.","Ensure the member directory is listed in [workspace] members and contains a valid Forc.toml.","Rebuild so the workspace is re-scanned."],"exampleFix":"# before\n# root Forc.toml\n[workspace]\nmembers = [\"libs/my_lib\"]\n[dependencies]\nmy-lib = { path = \"libs/my_lib\" }\n\n# after\n[dependencies]\nmy_lib = { path = \"libs/my_lib\" }  # must equal the member's [project] name","handlingStrategy":"validation","validationCode":"let member_names: std::collections::HashSet<&str> =\n    member_manifests.values().map(|m| m.project.name.as_str()).collect();\nfor dep_name in parent_manifest.dep_names() {\n    if is_workspace_member_ref(dep_name) && !member_names.contains(dep_name) {\n        return Err(format!(\"dependency '{dep_name}' does not match any workspace member name\"));\n    }\n}","typeGuard":"fn dependency_matches_member(name: &str, manifests: &forc_pkg::MemberManifestFiles) -> bool {\n    manifests.values().any(|m| m.project.name == name)\n}","tryCatchPattern":null,"preventionTips":["Keep dependency keys byte-identical to the member's [project] name (case-sensitive).","When renaming a member, update every dependent manifest in the same commit."],"tags":["workspace","dependencies","manifest"],"backgroundTag":null,"analyzedSha":"47e5e902faa42baf652dd6a0c88cd23390c1a614","analyzedAt":"2026-08-16T07:57:45.555Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}