{"record":{"id":"40b426f909bac04d","repo":"ipfs/kubo","slug":"unrecognized-fsn-type-v","errorCode":null,"errorMessage":"unrecognized fsn type: %#v","messagePattern":"unrecognized fsn type: %#v","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/coreunix/add.go","lineNumber":265,"sourceCode":"\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tchildpath := gopath.Join(path, name)\n\t\t\terr = adder.outputDirs(childpath, child)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfsn.Uncache(name)\n\t\t}\n\t\tnd, err := fsn.GetNode()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn outputDagnode(adder.Out, path, nd)\n\tdefault:\n\t\treturn fmt.Errorf(\"unrecognized fsn type: %#v\", fsn)\n\t}\n}\n\nfunc (adder *Adder) addNode(node ipld.Node, path string) error {\n\t// patch it into the root\n\tif path == \"\" {\n\t\tpath = node.Cid().String()\n\t}\n\n\tif pi, ok := node.(*posinfo.FilestoreNode); ok {\n\t\tnode = pi.Node\n\t}\n\n\tmr, err := adder.mfsRoot()\n\tif err != nil {\n\t\treturn err\n\t}\n","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/coreunix/add.go#L247-L283","documentation":"Adder's output handling dispatches on the type of an fsn (filesystem node) entry collected during a UnixFS add operation. When outputDirs/outputDagnode encounters an fsn value whose concrete type is neither a directory nor a recognized node kind, it fails with this error including the value formatted with %#v. It indicates an internal dispatch gap: a files.Node implementation that coreunix does not know how to serialize.","triggerScenarios":"Calling Adder.AddAllAndPin / Add with an files.Node implementation that is not files.File, files.Directory, or files.Symlink (e.g. a custom files.Node type implementing the interface but not one of the known concrete kinds), typically via files.NewMapFile or a wrapped custom node.","commonSituations":"Custom importer code wrapping or substituting files.Node types; passing a files.Node whose concrete type changed after a go-ipfs-files library version upgrade; mixing old import paths (github.com/ipfs/go-ipfs/files vs github.com/ipfs/go-libipfs/files) so type switches no longer match.","solutions":["Pass only standard files types: files.NewBytesFile, files.NewMapFile, files.NewSliceFile, files.NewSerialFile, files.NewSymlinkFile","Check that all files imports come from a single consistent package path (matching the kubo go-libipfs/files version)","Update kubo/coreunix and go-libipfs to compatible versions so type switches recognize your node types","If you truly need custom node kinds, convert them to a supported type (directory map, slice, or file) before adding"],"exampleFix":"// before: custom node unknown to the switch\ntype myNode struct{ files.Node }\nadder.AddAllAndPin(ctx, myNode{}...)  // unrecognized fsn type\n// after: convert to a supported type\nentry, _ := files.NewBytesFile(data)\niter := files.NewSliceFile(\"\", \"\", []files.Node{entry})\nadder.AddAllAndPin(ctx, iter, false)","handlingStrategy":"type-guard","validationCode":"switch n.(type) {\ncase files.File, *files.Symlink, files.Directory:\n\t// ok\ndefault:\n\treturn fmt.Errorf(\"unsupported node type %T\", n)\n}","typeGuard":"func isKnownFsn(n files.Node) bool {\n\tswitch n.(type) {\n\tcase files.File, *files.Symlink, files.Directory:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}","tryCatchPattern":"if err := adder.AddAllAndPin(ctx, node, false); err != nil {\n\tif strings.Contains(err.Error(), \"unrecognized fsn type\") {\n\t\treturn fmt.Errorf(\"convert node %T to a supported files kind\", node)\n\t}\n\treturn err\n}","preventionTips":["Only build inputs with files.NewBytesFile/NewMapFile/NewSliceFile/NewSerialFile/NewSymlinkFile","Use a single consistent go-libipfs/files import path","When wrapping files.Node, unwrap to the underlying supported type before adding","Pin go-libipfs and kubo versions together"],"tags":["unixfs","add","importer","type-dispatch"],"backgroundTag":"unrecognized-node-type","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"}