ipfs/kubo · error

%q is not an IPFS path

Error message

%q is not an IPFS path

What it means

parsePath parses the string as a URL successfully, but the scheme is not one of "ipfs", "ipld", or "ipns", so the fetcher cannot interpret it as an IPFS path. The migrations fetcher only knows how to resolve these three scheme families.

Source

Thrown at repo/fsrepo/migrations/ipfsfetcher/ipfsfetcher.go:284

	return nil
}

func parsePath(fetchPath string) (path.Path, error) {
	if ipfsPath, err := path.NewPath(fetchPath); err == nil {
		return ipfsPath, nil
	}

	u, err := url.Parse(fetchPath)
	if err != nil {
		return nil, fmt.Errorf("%q could not be parsed: %s", fetchPath, err)
	}

	switch proto := u.Scheme; proto {
	case "ipfs", "ipld", "ipns":
		return path.NewPath(gopath.Join("/", proto, u.Host, u.Path))
	default:
		return nil, fmt.Errorf("%q is not an IPFS path", fetchPath)
	}
}

func readIpfsConfig(repoRoot *string, userConfigFile string) (bootstrap []string, peers []peer.AddrInfo) {
	if repoRoot == nil {
		return
	}

	cfgPath, err := config.Filename(*repoRoot, userConfigFile)
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		return
	}

	cfgFile, err := os.Open(cfgPath)
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		return

View on GitHub (pinned to 329838acdf)

Solutions

  1. Convert the reference to an IPFS path form: strip the gateway prefix and pass "/ipfs/<cid>" (or /ipns/..., /ipld/...).
  2. If you meant an HTTP download, use the HTTP fetcher (NewHttpFetcher) or include the URL in Migration.DownloadSources instead.
  3. Validate the scheme before calling Fetch: parse the URL and check it is ipfs/ipld/ipns.

Example fix

// before
f.Fetch("https://ipfs.io/ipfs/QmHash")
// after
f.Fetch("/ipfs/QmHash")
Defensive patterns

Strategy: validation

Validate before calling

u, _ := url.Parse(s)
switch u.Scheme {
case "ipfs", "ipld", "ipns":
    // OK for ipfsfetcher.Fetch
default:
    // use HttpFetcher instead
}

Try / catch

if err != nil {
    if strings.Contains(err.Error(), "is not an IPFS path") {
        // fall back to HTTP fetcher
    }
}

Prevention

When it happens

Trigger: Calling Fetch with a path whose scheme is http/https, file, or any other non-IPFS scheme, e.g. Fetch("https://example.com/ipfs/Qm...") instead of Fetch("/ipfs/Qm...").

Common situations: Passing a full gateway HTTP URL where an IPFS path is expected; using "dweb:/ipfs/..." links; misconfiguring Migration.DownloadSources so an IPFS fetcher receives an HTTPS gateway URL.

Related errors


AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03). Data as JSON: /api/errors/098aca122eeb65be. Report an issue: GitHub.