{"record":{"id":"d7e1e1630a294b51","repo":"FuelLabs/sway","slug":"failed-to-construct-path-for-dependency","errorCode":null,"errorMessage":"failed to construct path for dependency {:?}: {}","messagePattern":"failed to construct path for dependency (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"forc-pkg/src/pkg.rs","lineNumber":1009,"sourceCode":"    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)?;\n    let dep_pkg = graph[dep_node].unpinned(&dep_path);\n    if dep_pkg.source != dep_source {\n        bail!(\"dependency node's source does not match manifest entry\");","sourceCodeStart":991,"sourceCodeEnd":1027,"githubUrl":"https://github.com/FuelLabs/sway/blob/47e5e902faa42baf652dd6a0c88cd23390c1a614/forc-pkg/src/pkg.rs#L991-L1027","documentation":"A wrapper produced while validating one graph edge: dep_path() failed while resolving where the dependency lives on disk, and {} carries the real reason. Typical inner causes: 'cannot find dependency in the workspace', 'no dependency or patch with name ... in manifest of ...', or a missing Forc.toml inside a path dependency's directory.","triggerScenarios":"A path dependency whose directory no longer contains Forc.toml (moved folder, missing submodule); a dependency treated as a workspace member whose name is not found; patch target missing; offline fetch of a git/ipfs dependency surfacing here.","commonSituations":"Moving or renaming a path-dependency folder without updating Forc.toml; forgetting 'git submodule update --init --recursive'; typos in member names; network/IPFS node unavailable for remote deps.","solutions":["Read the inner {} message - it names the specific sub-cause; fix that first.","Verify each path dependency directory exists and contains a Forc.toml.","Run 'git submodule update --init --recursive' if dependencies are submodules.","Check spelling of member/dependency names and that the IPFS node or network is reachable for remote dependencies."],"exampleFix":"# before: path moved\n[dependencies]\nlib = { path = \"../old-location/lib\" }\n\n# after\n[dependencies]\nlib = { path = \"../libs/lib\" }","handlingStrategy":"try-catch","validationCode":"// for each path dependency, require the target to contain a manifest\nfor (name, dep) in pkg_manifest.dependencies() {\n    if let Some(p) = dep.path() {\n        let dir = manifest_dir.join(&p);\n        if !dir.join(\"Forc.toml\").is_file() {\n            return Err(format!(\"path dependency '{name}' has no Forc.toml at {}\", dir.display()));\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = build_plan_result {\n    for cause in anyhow::Error::chain(&e) {\n        let s = cause.to_string();\n        if s.starts_with(\"failed to construct path for dependency\") {\n            // inspect the inner cause: missing member, missing Forc.toml, absent patch\n            diagnostics.push(s);\n        }\n    }\n}","preventionTips":["Run 'git submodule update --init --recursive' before building repos with vendored deps.","Keep path entries relative and verify the folders exist in CI.","Make dependency keys match member names exactly."],"tags":["dependencies","path","graph","workspace"],"backgroundTag":null,"analyzedSha":"47e5e902faa42baf652dd6a0c88cd23390c1a614","analyzedAt":"2026-08-16T07:57:45.555Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}