{"record":{"id":"2c400eb680e4fd23","repo":"ipfs/kubo","slug":"unsupported-file-type-s","errorCode":null,"errorMessage":"unsupported file type '%s'","messagePattern":"unsupported file type '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/rpc/apifile.go","lineNumber":61,"sourceCode":"\tmode, err := stringToFileMode(stat.Mode)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar modTime time.Time\n\tif stat.Mtime != 0 {\n\t\tmodTime = time.Unix(stat.Mtime, int64(stat.MtimeNsecs)).UTC()\n\t}\n\n\tswitch stat.Type {\n\tcase \"file\":\n\t\treturn api.getFile(ctx, p, stat.Size, mode, modTime)\n\tcase \"directory\":\n\t\treturn api.getDir(ctx, p, stat.Size, mode, modTime)\n\tcase \"symlink\":\n\t\treturn api.getSymlink(ctx, p, modTime)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported file type '%s'\", stat.Type)\n\t}\n}\n\ntype apiFile struct {\n\tctx  context.Context\n\tcore *HttpApi\n\tsize int64\n\tpath path.Path\n\n\tmode  os.FileMode\n\tmtime time.Time\n\n\tr  *Response\n\tat int64\n}\n\nfunc (f *apiFile) reset() error {\n\tif f.r != nil {","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/client/rpc/apifile.go#L43-L79","documentation":"The client/rpc Get helper resolves a UnixFS entry via the ls/stat RPC and materializes it as a files.Node locally. When the reported stat.Type is none of file/directory/symlink, it has no local representation and returns this error, embedding the unexpected type. Typically the type string comes from a newer daemon exposing a type this client version does not understand.","triggerScenarios":"Calling UnixfsAPI.Get (or the ipfsGet path) on a path whose stat.Type is not 'file', 'directory', or 'symlink' — e.g. an empty/different type string, a newer daemon reporting raw/hamt-shard differently, or a server returning an unexpected RPC shape.","commonSituations":"Version mismatch: new daemon (new UnixFS type rendering) with an old go client; fetching MFS entries that are UnixFS HAMT shards rendered unexpectedly; hand-rolled proxies that alter the ls RPC response.","solutions":["Upgrade client/rpc (and kubo) on both sides so daemon and client versions match","Check the type string with `ipfs files stat` or `ipfs ls` to see what the entry actually is","If it is a HAMT directory, access its contents via the normal directory listing path rather than fetching the shard node directly","Handle the error by falling back to `ipfs get`/`dag export` for unknown types"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"stat, err := api.Object().Stat(ctx, p) // or files stat\nif err == nil {\n    t := stat.Type\n    if t != \"file\" && t != \"directory\" && t != \"symlink\" {\n        return fmt.Errorf(\"client cannot handle type %q; upgrade client/rpc\", t)\n    }\n}","typeGuard":"func knownUnixfsType(t string) bool {\n    switch t { case \"file\", \"directory\", \"symlink\": return true }\n    return false\n}","tryCatchPattern":"node, err := api.Unixfs().Get(ctx, p)\nif err != nil && strings.Contains(err.Error(), \"unsupported file type\") {\n    // fall back to raw fetch\n    return api.Dag().Get(ctx, p)\n}","preventionTips":["Keep client and daemon versions aligned","Check `ipfs files stat` output for the entry type before Get","Use dag export for types the client cannot represent"],"tags":["go","ipfs","rpc","unixfs"],"backgroundTag":"unsupported-file-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"}