{"record":{"id":"b7dc0b796f307aa8","repo":"FuelLabs/sway","slug":"found-dep-without-node-entry-in-graph","errorCode":null,"errorMessage":"found dep {} without node entry in graph","messagePattern":"found dep (.+?) without node entry in graph","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"forc-pkg/src/lock.rs","lineNumber":224,"sourceCode":"                .as_ref()\n                .into_iter()\n                .flatten()\n                .map(|contract_dep| (contract_dep, UnparsedDepKind::Contract));\n            // If `pkg.dependencies` is None, we will be collecting an empty list of\n            // lib_deps so that we will omit them during edge adding phase\n            let lib_deps = pkg\n                .dependencies\n                .as_ref()\n                .into_iter()\n                .flatten()\n                .map(|lib_dep| (lib_dep, UnparsedDepKind::Library));\n            for (dep_line, dep_kind) in lib_deps.chain(contract_deps) {\n                let (dep_name, dep_key, dep_salt) = parse_pkg_dep_line(dep_line)\n                    .map_err(|e| anyhow!(\"failed to parse dependency \\\"{}\\\": {}\", dep_line, e))?;\n                let dep_node = pkg_to_node\n                    .get(dep_key)\n                    .copied()\n                    .ok_or_else(|| anyhow!(\"found dep {} without node entry in graph\", dep_key))?;\n                let dep_name = dep_name.unwrap_or(&graph[dep_node].name).to_string();\n                let dep_kind = match dep_kind {\n                    UnparsedDepKind::Library => DepKind::Library,\n                    UnparsedDepKind::Contract => {\n                        let dep_salt = dep_salt.unwrap_or_default();\n                        DepKind::Contract { salt: dep_salt }\n                    }\n                };\n                let dep_edge = Edge::new(dep_name, dep_kind);\n                graph.update_edge(node, dep_node, dep_edge);\n            }\n        }\n\n        Ok(graph)\n    }\n\n    /// Create a diff between `self` and the `old` `Lock`.\n    ///","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/FuelLabs/sway/blob/47e5e902faa42baf652dd6a0c88cd23390c1a614/forc-pkg/src/lock.rs#L206-L242","documentation":"Lock::to_graph works in two passes: first every [[package]] entry becomes a graph node keyed by '<name> <source>' (or just the name when unambiguous), then every dependency line is looked up in that key map. This error means a dependency line references a key that has no matching package entry - the lock's edges are inconsistent with its node list.","triggerScenarios":"A Forc.lock where a package's dependency line (name plus source) does not exactly match any [[package]] entry - typically a merge kept the dependency line but dropped or altered the target package entry, or a hand edit changed one side (name or source) without updating the other.","commonSituations":"Git merges of Forc.lock resolving to an inconsistent mix of both sides; renames of dependencies; two packages sharing a name where disambiguation keys (name+source) diverge between the edge and node sections.","solutions":["Delete Forc.lock and rebuild so the package table and dependency edges are regenerated together.","When hand-fixing, ensure the dependency line's name and source exactly equal the target [[package]] entry's name and source.","Treat Forc.lock as generated: resolve dependency conflicts in Forc.toml (or git ours/theirs on the lock) and regenerate."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Rust, consistency pre-check: every dep-line key must exist among package keys.\n// Build both sets as '<name> <source>' (or bare name when unambiguous) and diff them,\n// surfacing missing entries before calling to_graph.","typeGuard":null,"tryCatchPattern":"// Inconsistent lock -> regenerate rather than patch edges:\nmatch lock.to_graph() {\n    Ok(g) => { /* ... */ }\n    Err(_) => { fs::remove_file(lock_path).ok(); /* rebuild plan from manifests */ }\n}","preventionTips":["Regenerate Forc.lock wholesale after dependency or merge changes.","If hand-fixing, keep dependency lines and package entries exactly name+source matched.","Beware duplicate package names: disambiguation makes key mismatches easy to introduce."],"tags":["forc","forc-pkg","lockfile","graph","merge-conflict"],"backgroundTag":null,"analyzedSha":"47e5e902faa42baf652dd6a0c88cd23390c1a614","analyzedAt":"2026-08-16T07:57:45.555Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}