ipfs/kubo · error

file type %d not supported

Error message

file type %d not supported

What it means

During directory iteration, apiIter switches on it.cur.Type (a numeric UnixFS entry type from the ls RPC) to build the files.Node: file, directory, or symlink. Any other numeric type hits the default branch and records this error, stopping iteration. It guards against new/unknown entry types the client cannot materialize locally.

Source

Thrown at client/rpc/apifile.go:259

		it.curFile, err = it.core.getDir(it.ctx, path.FromCid(c), int64(it.cur.Size), it.cur.Mode, it.cur.ModTime)
		if err != nil {
			it.err = err
			return false
		}
	case unixfs.TFile:
		it.curFile, err = it.core.getFile(it.ctx, path.FromCid(c), int64(it.cur.Size), it.cur.Mode, it.cur.ModTime)
		if err != nil {
			it.err = err
			return false
		}
	case unixfs.TSymlink:
		it.curFile, err = it.core.getSymlink(it.ctx, path.FromCid(c), it.cur.ModTime)
		if err != nil {
			it.err = err
			return false
		}
	default:
		it.err = fmt.Errorf("file type %d not supported", it.cur.Type)
		return false
	}
	return true
}

func (it *apiIter) Node() files.Node {
	return it.curFile
}

type apiDir struct {
	ctx  context.Context
	core *UnixfsAPI
	size int64
	path path.Path

	mode  os.FileMode
	mtime time.Time

View on GitHub (pinned to 329838acdf)

Solutions

  1. Upgrade client/rpc so it recognizes the entry type reported by the daemon
  2. Align kubo versions between client and daemon
  3. Inspect entry types with `ipfs ls <dir>` to identify the offending type
  4. Skip or substitute unknown entries in your own iteration code if you call the ls RPC directly
Defensive patterns

Strategy: validation

Validate before calling

// pre-list the directory and skip unknown numeric types
var out struct{ Objects []struct{ Links []struct{ Type int `json:"Type"` } `json:"Links"` } `json:"Objects"` }
_ = api.Request("ls").Option("arg", dir).Exec(ctx, &out)
for _, l := range out.Objects[0].Links {
    if l.Type < 0 || l.Type > 3 { log.Printf("skipping entry with unknown type %d", l.Type) }
}

Type guard

func knownLsEntryType(t int) bool { return t >= 0 && t <= 3 }

Try / catch

if strings.Contains(err.Error(), "file type ") && strings.Contains(err.Error(), "not supported") {
    // skip the entry or upgrade the client
    return iterateSkippingUnknown(ctx, api, dir)
}

Prevention

When it happens

Trigger: Iterating a directory (via UnixfsAPI.Get on a directory path) that contains an entry whose ls Type value is not one of the known numeric constants (0/1/2/3 per the RPC schema) — usually a type added by a newer daemon.

Common situations: Newer daemon listing HAMT shards or raw nodes that this client cannot represent; version-skewed client/daemon; custom servers emitting out-of-range Type values.

Related errors


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