FuelLabs/sway · error · anyhow::Error
offline fetching for IPFS sources is not supported
Error message
offline fetching for IPFS sources is not supported
What it means
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.
Source
Thrown at forc-pkg/src/source/ipfs.rs:59
Ok(Self(cid))
}
}
impl source::Pin for Source {
type Pinned = Pinned;
fn pin(&self, _ctx: source::PinCtx) -> Result<(Self::Pinned, PathBuf)> {
let cid = &self.0;
let pinned = Pinned(cid.clone());
let path = pkg_cache_dir(cid);
Ok((pinned, path))
}
}
impl source::Fetch for Pinned {
fn fetch(&self, ctx: source::PinCtx, repo_path: &Path) -> Result<PackageManifestFile> {
// TODO: implement local cache search for ipfs sources.
if ctx.offline {
anyhow::bail!("offline fetching for IPFS sources is not supported")
}
let mut lock = forc_util::path_lock(repo_path)?;
// TODO: Here we assume that if the local path already exists, that it contains the
// full and correct source for that registry entry and hasn't been tampered with. This is
// probably fine for most cases as users should never be touching these
// directories, however we should add some code to validate this. E.g. can we
// recreate the ipfs cid by hashing the directory or something along these lines?
// https://github.com/FuelLabs/sway/issues/7075
{
let _guard = lock.write()?;
if !repo_path.exists() {
println_action_green(
"Fetching",
&format!(
"{} {}",
ansiterm::Style::new().bold().paint(ctx.name()),
selfView on GitHub (pinned to 47e5e902fa)
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
Defensive patterns
Strategy: validation
Validate before calling
fn manifest_has_ipfs_dep(manifest: &forc_pkg::manifest::PackageManifest) -> bool {
manifest
.dependencies
.values()
.iter()
.any(|d| matches!(d, forc_pkg::manifest::Dependency::Ipfs(_)))
}
// before enabling offline mode:
// if opts.offline && manifest_has_ipfs_dep(&pkg_manifest) {
// bail!("--offline cannot be used with ipfs dependencies");
// } Prevention
- 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
When it happens
Trigger: Running any forc command with --offline while Forc.toml contains ipfs = ... dependencies; the check happens before any cache or network access is attempted.
Common situations: Teams standardizing on --offline in CI discovering one dependency is IPFS-sourced; air-gapped build environments.
Related errors
- Unable to fetch pkg {:?} from {:?} in offline mode
- IPFS API request to {url} failed with status {}
- Failed to fetch from {fetch_url:?}
- failed to read {}: {}
- invalid 'source' entry for package {} lock: {:?}
AI-assisted analysis of FuelLabs/sway@47e5e902fa (2026-08-16).
Data as JSON: /api/errors/f540ec19c0deb9cc.
Report an issue: GitHub.