{"record":{"id":"ed6d54c2d24c59c7","repo":"FuelLabs/sway","slug":"failed-to-find-package-in-ed6d54","errorCode":null,"errorMessage":"failed to find package `{}` in {}","messagePattern":"failed to find package `(.+?)` in (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"forc-pkg/src/source/ipfs.rs","lineNumber":107,"sourceCode":"                        }\n                        source::IPFSNode::WithUrl(ipfs_node_gateway_url) => {\n                            println_action_green(\n                                \"Fetching\",\n                                &format!(\n                                    \"from {ipfs_node_gateway_url}. Note: This can take several minutes.\"\n                                ),\n                            );\n                            cid.fetch_with_gateway_url(&ipfs_node_gateway_url, &dest)\n                                .await\n                        }\n                    }\n                })?;\n            }\n        }\n        let path = {\n            let _guard = lock.read()?;\n            manifest::find_within(repo_path, ctx.name()).ok_or_else(|| {\n                anyhow::anyhow!(\"failed to find package `{}` in {}\", ctx.name(), self)\n            })?\n        };\n        PackageManifestFile::from_file(path)\n    }\n}\n\nimpl source::DepPath for Pinned {\n    fn dep_path(&self, name: &str) -> anyhow::Result<source::DependencyPath> {\n        let repo_path = pkg_cache_dir(&self.0);\n        // Co-ordinate access to the ipfs checkout directory using an advisory file lock.\n        let lock = forc_util::path_lock(&repo_path)?;\n        let _guard = lock.read()?;\n        let path = manifest::find_within(&repo_path, name)\n            .ok_or_else(|| anyhow::anyhow!(\"failed to find package `{}` in {}\", name, self))?;\n        Ok(source::DependencyPath::ManifestPath(path))\n    }\n}\n","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/FuelLabs/sway/blob/47e5e902faa42baf652dd6a0c88cd23390c1a614/forc-pkg/src/source/ipfs.rs#L89-L125","documentation":"Mirror of the git path: after downloading and extracting the IPFS archive into the cache directory, forc searches it for a package whose [project].name equals the dependency key. Nothing found yields this error with the requested name and the cid source.","triggerScenarios":"The dependency key in [dependencies] does not match the package name inside the content addressed by the cid; the cid points at a directory that contains no Forc.toml declaring that name.","commonSituations":"Assuming the cid's project name equals the dependency key; upstream renamed the package while the same cid convention was kept in docs.","solutions":["Inspect the cached extraction under the ipfs cache directory and use the exact [project].name as your dependency key","If the cid itself is wrong, obtain the correct cid from the package maintainer","Delete Forc.lock and re-resolve after fixing the dependency key"],"exampleFix":"# before\n[dependencies]\ntokens = { ipfs = \"Qm...\" }  # package inside is named \"sway_lib_tokens\"\n\n# after\n[dependencies]\nsway_lib_tokens = { ipfs = \"Qm...\" }","handlingStrategy":"validation","validationCode":"use forc_pkg::manifest;\n\n// after fetching the cid content, verify the declared name exists inside it\nif manifest::find_within(&ipfs_cache_dir, dep_name).is_none() {\n    anyhow::bail!(\"`{dep_name}` not found inside ipfs content {cid}; check its Forc.toml [project].name\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Confirm the package name inside the ipfs content before choosing the dependency key","Take dependency snippets from the maintainer's docs verbatim","Re-resolve Forc.lock after fixing keys"],"tags":["ipfs","dependencies","manifest","naming"],"backgroundTag":null,"analyzedSha":"47e5e902faa42baf652dd6a0c88cd23390c1a614","analyzedAt":"2026-08-16T07:57:45.555Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}