{"record":{"id":"56a1c358f1886ab9","repo":"FuelLabs/sway","slug":"the-dependency-could-not-be-found-in","errorCode":null,"errorMessage":"the dependency `{}` could not be found in `{}`","messagePattern":"the dependency `(.+?)` could not be found in `(.+?)`","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"forc-pkg/src/manifest/dep_modifier.rs","lineNumber":358,"sourceCode":"                    }\n                    Dependency::Detailed(details) => {\n                        let mut inline = generate_table(details);\n                        inline.insert(\"salt\", Value::from(format!(\"0x{salt}\")));\n                        Item::Value(toml_edit::Value::InlineTable(inline))\n                    }\n                };\n                table.insert(&dep_name, item);\n            }\n        };\n\n        Ok(())\n    }\n\n    pub fn remove_deps_manifest_table(self, doc: &mut DocumentMut, deps: &[&str]) -> Result<()> {\n        let section_name = self.to_string();\n\n        let section_table = doc[section_name.as_str()].as_table_mut().ok_or_else(|| {\n            anyhow!(\n                \"the dependency `{}` could not be found in `{}`\",\n                deps.join(\", \"),\n                section_name,\n            )\n        })?;\n\n        match self {\n            Section::Deps => {\n                for dep in deps {\n                    if !section_table.contains_key(dep) {\n                        bail!(\n                            \"the dependency `{}` could not be found in `{}`\",\n                            dep,\n                            section_name\n                        );\n                    }\n                    section_table.remove(dep);\n                }","sourceCodeStart":340,"sourceCodeEnd":376,"githubUrl":"https://github.com/FuelLabs/sway/blob/47e5e902faa42baf652dd6a0c88cd23390c1a614/forc-pkg/src/manifest/dep_modifier.rs#L340-L376","documentation":"remove_deps_manifest_table removes entries from a section of Forc.toml ([dependencies] or [contract-dependencies]). The quoted branch fires when the whole section table is absent from the manifest (doc[section_name].as_table_mut() returns None); the same message is also bailed just below for a present section that lacks one of the named keys. Either way, the manifest does not contain what forc remove was asked to remove.","triggerScenarios":"Running forc remove <pkg> when Forc.toml has no [dependencies] table at all, or the dependency key exists only under a different section (e.g. contract-dependencies) or with a different spelling; the contract-deps variant hits the same guard for [contract-dependencies].","commonSituations":"Typo'd dependency names; wrong section (plain dep vs contract dep) because the matching flag was not passed; manifests where the section was already cleaned; running remove in the wrong project directory.","solutions":["Open Forc.toml and confirm the exact key exists under the expected section before removing.","Use the flag matching the section: forc remove --contract-dependency <name> for contract deps, plain forc remove <name> for libraries.","If the section genuinely does not exist, there is nothing to remove - delete the entry manually or skip.","Check spelling and hyphenation of the dependency key as written in the manifest."],"exampleFix":"# before: forc remove foo  but Forc.toml has only\n[contract-dependencies]\nfoo = { ... }\n\n# after: target the right section\n$ forc remove --contract-dependency foo","handlingStrategy":"validation","validationCode":"// Rust/shell, verify section and key exist before invoking forc remove:\n// shell:\n//   grep -q '^\\[dependencies\\]$' Forc.toml && grep -q '^foo *= ' Forc.toml\n// Rust: parse the manifest with toml_edit and assert doc[\"dependencies\"][name].is_some().","typeGuard":null,"tryCatchPattern":"// anyhow Result - inspect and guide:\nmatch remove_deps(...) {\n    Err(e) if e.to_string().contains(\"could not be found\") =>\n        eprintln!(\"check the section ([dependencies] vs [contract-dependencies]) and key spelling\"),\n    other => other.unwrap(),\n}","preventionTips":["Read Forc.toml to confirm the exact dependency key before removing.","Match the CLI flag to the section the dependency lives in.","Keep dependency names consistent between Forc.toml and commands (hyphens, case)."],"tags":["forc","manifest","dependencies","cli"],"backgroundTag":null,"analyzedSha":"47e5e902faa42baf652dd6a0c88cd23390c1a614","analyzedAt":"2026-08-16T07:57:45.555Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}