{"record":{"id":"f540ec19c0deb9cc","repo":"FuelLabs/sway","slug":"offline-fetching-for-ipfs-sources-is-not-supported","errorCode":null,"errorMessage":"offline fetching for IPFS sources is not supported","messagePattern":"offline fetching for IPFS sources is not supported","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"forc-pkg/src/source/ipfs.rs","lineNumber":59,"sourceCode":"        Ok(Self(cid))\n    }\n}\n\nimpl source::Pin for Source {\n    type Pinned = Pinned;\n    fn pin(&self, _ctx: source::PinCtx) -> Result<(Self::Pinned, PathBuf)> {\n        let cid = &self.0;\n        let pinned = Pinned(cid.clone());\n        let path = pkg_cache_dir(cid);\n        Ok((pinned, path))\n    }\n}\n\nimpl source::Fetch for Pinned {\n    fn fetch(&self, ctx: source::PinCtx, repo_path: &Path) -> Result<PackageManifestFile> {\n        // TODO: implement local cache search for ipfs sources.\n        if ctx.offline {\n            anyhow::bail!(\"offline fetching for IPFS sources is not supported\")\n        }\n\n        let mut lock = forc_util::path_lock(repo_path)?;\n        // TODO: Here we assume that if the local path already exists, that it contains the\n        // full and correct source for that registry entry and hasn't been tampered with. This is\n        // probably fine for most cases as users should never be touching these\n        // directories, however we should add some code to validate this. E.g. can we\n        // recreate the ipfs cid by hashing the directory or something along these lines?\n        // https://github.com/FuelLabs/sway/issues/7075\n        {\n            let _guard = lock.write()?;\n            if !repo_path.exists() {\n                println_action_green(\n                    \"Fetching\",\n                    &format!(\n                        \"{} {}\",\n                        ansiterm::Style::new().bold().paint(ctx.name()),\n                        self","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/FuelLabs/sway/blob/47e5e902faa42baf652dd6a0c88cd23390c1a614/forc-pkg/src/source/ipfs.rs#L41-L77","documentation":"The IPFS source implementation has no local-cache search path (there is an explicit TODO in the code), so fetch() with offline=true immediately bails: offline mode is simply unsupported for ipfs dependencies, regardless of whether content happens to be cached.","triggerScenarios":"Running any forc command with --offline while Forc.toml contains ipfs = ... dependencies; the check happens before any cache or network access is attempted.","commonSituations":"Teams standardizing on --offline in CI discovering one dependency is IPFS-sourced; air-gapped build environments.","solutions":["Remove --offline for builds that include IPFS dependencies","Replace the ipfs dependency with a git/path/registry source for offline-capable environments","Until local IPFS cache support lands upstream, keep network access available for builds with ipfs deps"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"fn manifest_has_ipfs_dep(manifest: &forc_pkg::manifest::PackageManifest) -> bool {\n    manifest\n        .dependencies\n        .values()\n        .iter()\n        .any(|d| matches!(d, forc_pkg::manifest::Dependency::Ipfs(_)))\n}\n\n// before enabling offline mode:\n// if opts.offline && manifest_has_ipfs_dep(&pkg_manifest) {\n//     bail!(\"--offline cannot be used with ipfs dependencies\");\n// }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Audit dependency sources before standardizing on --offline in CI","Prefer git or registry sources for reproducible offline builds","Document that IPFS deps always require network access in current forc"],"tags":["ipfs","offline","network","forc"],"backgroundTag":null,"analyzedSha":"47e5e902faa42baf652dd6a0c88cd23390c1a614","analyzedAt":"2026-08-16T07:57:45.555Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}