ipfs/kubo · error

cp: cannot get node from path %s: %s

Error message

cp: cannot get node from path %s: %s

What it means

`ipfs files cp` could not resolve the source path to a node at all. The error wraps whatever getNodeFromPath returned, indicating the source path (e.g. /ipfs/<CID> or an MFS path) failed to resolve — most commonly because the content is not present locally and the node can't fetch it, or the path is malformed.

Source

Thrown at core/commands/files.go:546

		src, err := checkContentOrMfsPath(req.Arguments[0])
		if err != nil {
			return err
		}
		src = strings.TrimRight(src, "/")

		dst, err := checkPath(req.Arguments[1])
		if err != nil {
			return err
		}

		if dst[len(dst)-1] == '/' {
			dst += gopath.Base(src)
		}

		node, err := getNodeFromPath(req.Context, nd, api, src)
		if err != nil {
			return fmt.Errorf("cp: cannot get node from path %s: %s", src, err)
		}

		// Sanity-check: ensure root CID is a valid UnixFS (dag-pb or raw block)
		// Context: https://github.com/ipfs/kubo/issues/10331
		srcCidType := node.Cid().Type()
		switch srcCidType {
		case cid.Raw:
			if _, ok := node.(*dag.RawNode); !ok {
				return errFilesCpInvalidUnixFS
			}
		case cid.DagProtobuf:
			if _, ok := node.(*dag.ProtoNode); !ok {
				return errFilesCpInvalidUnixFS
			}
			if _, err = ft.FSNodeFromBytes(node.(*dag.ProtoNode).Data()); err != nil {
				return fmt.Errorf("%w: %v", errFilesCpInvalidUnixFS, err)
			}
		default:

View on GitHub (pinned to 329838acdf)

Solutions

  1. Verify the source resolves: `ipfs cat <src>` or `ipfs ls <src>` first
  2. Start the daemon (`ipfs daemon`) so remote content can be fetched, or provide connectivity
  3. If content was garbage-collected, re-fetch or re-pin it before copying
  4. Check the path syntax: source must be /ipfs/<CID>, /ipns/<name>, or an existing MFS path

Example fix

// before
ipfs files cp /ipfs/QmXyz... /my-file
// error: cp: cannot get node from path /ipfs/QmXyz...: ...

// after: ensure content is locally available first
ipfs dag get /ipfs/QmXyz... > /dev/null  # warms the local cache or reports the real fetch error
ipfs files cp /ipfs/QmXyz... /my-file
Defensive patterns

Strategy: validation

Validate before calling

// ensure the source resolves before cp
if err := run("ipfs", "dag", "get", src); err != nil {
    return fmt.Errorf("source %s not resolvable: %w", src, err)
}

Try / catch

if err := ipfsFilesCp(src, dst); err != nil {
    if strings.Contains(err.Error(), "cannot get node from path") {
        // check daemon running / local copy present, then retry
    }
}

Prevention

When it happens

Trigger: Running `ipfs files cp <src> <dst>` where src is an /ipfs/ path whose blocks cannot be retrieved (offline node without local copy, DHT lookup failure), or src is an invalid/unresolvable MFS or IPNS path.

Common situations: Running `ipfs files cp` while the daemon is offline and the source CID is not pinned/locally available; typos in the source path; expired or missing IPNS names; content removed by GC.

Related errors


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