{"record":{"id":"7e88272a0853806d","repo":"ipfs/kubo","slug":"not-unixfs-node-proto-or-raw","errorCode":null,"errorMessage":"not unixfs node (proto or raw)","messagePattern":"not unixfs node \\(proto or raw\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/files.go","lineNumber":393,"sourceCode":"\n\tcumulsize, err := nd.Size()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch n := nd.(type) {\n\tcase *dag.ProtoNode:\n\t\treturn statProtoNode(n, enc, c, cumulsize)\n\tcase *dag.RawNode:\n\t\treturn &statOutput{\n\t\t\tHash:           enc.Encode(c),\n\t\t\tBlocks:         0,\n\t\t\tSize:           cumulsize,\n\t\t\tCumulativeSize: cumulsize,\n\t\t\tType:           \"file\",\n\t\t}, nil\n\tdefault:\n\t\treturn nil, errors.New(\"not unixfs node (proto or raw)\")\n\t}\n}\n\nfunc statProtoNode(n *dag.ProtoNode, enc cidenc.Encoder, cid cid.Cid, cumulsize uint64) (*statOutput, error) {\n\td, err := ft.FSNodeFromBytes(n.Data())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstat := statOutput{\n\t\tHash:           enc.Encode(cid),\n\t\tBlocks:         len(n.Links()),\n\t\tSize:           d.FileSize(),\n\t\tCumulativeSize: cumulsize,\n\t}\n\n\tswitch d.Type() {\n\tcase ft.TDirectory, ft.THAMTShard:","sourceCodeStart":375,"sourceCodeEnd":411,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/files.go#L375-L411","documentation":"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.","triggerScenarios":"Thrown at core/commands/files.go:393 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the object with 'ipfs dag get' or 'ipfs cid format' to learn its codec","Use 'ipfs dag stat' instead, which handles non-UnixFS nodes","Operate on a UnixFS (dag-pb/raw) path"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"329838acdfafae224582930457efe80aa217afc0","analyzedAt":"2026-09-03T18:30:52.135Z","contentChangedAt":"2026-09-03T18:30:52.135Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}