ipfs/kubo · error

not unixfs node (proto or raw)

Error message

not unixfs node (proto or raw)

What it means

files stat's default arm: the resolved DAG node behind the MFS path is neither a dag.ProtoNode nor a dag.RawNode, so it has no UnixFS representation to compute stats from. The CID at that path points at some other IPLD codec or an exotic node type.

Source

Thrown at core/commands/files.go:393

	cumulsize, err := nd.Size()
	if err != nil {
		return nil, err
	}

	switch n := nd.(type) {
	case *dag.ProtoNode:
		return statProtoNode(n, enc, c, cumulsize)
	case *dag.RawNode:
		return &statOutput{
			Hash:           enc.Encode(c),
			Blocks:         0,
			Size:           cumulsize,
			CumulativeSize: cumulsize,
			Type:           "file",
		}, nil
	default:
		return nil, errors.New("not unixfs node (proto or raw)")
	}
}

func statProtoNode(n *dag.ProtoNode, enc cidenc.Encoder, cid cid.Cid, cumulsize uint64) (*statOutput, error) {
	d, err := ft.FSNodeFromBytes(n.Data())
	if err != nil {
		return nil, err
	}

	stat := statOutput{
		Hash:           enc.Encode(cid),
		Blocks:         len(n.Links()),
		Size:           d.FileSize(),
		CumulativeSize: cumulsize,
	}

	switch d.Type() {
	case ft.TDirectory, ft.THAMTShard:

View on GitHub (pinned to 329838acdf)

Solutions

  1. Inspect the object with 'ipfs dag get' or 'ipfs cid format' to learn its codec
  2. Use 'ipfs dag stat' instead, which handles non-UnixFS nodes
  3. Operate on a UnixFS (dag-pb/raw) path
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at core/commands/files.go:393 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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