ipfs/kubo · error

unrecognized type

Error message

unrecognized type

What it means

'ipfs files ls' hit its default arm when classifying the looked-up MFS node: fsn.Type() returned a directory-entry type the switch does not cover (only file/directory cases are handled). Indicates an MFS node in an unexpected state rather than bad user input.

Source

Thrown at core/commands/files.go:777

			out := &filesLsOutput{[]mfs.NodeListing{{Name: name}}}
			if long {
				out.Entries[0].Type = int(fsn.Type())

				size, err := fsn.Size()
				if err != nil {
					return err
				}
				out.Entries[0].Size = size

				nd, err := fsn.GetNode()
				if err != nil {
					return err
				}
				out.Entries[0].Hash = enc.Encode(nd.Cid())
			}
			return cmds.EmitOnce(res, out)
		default:
			return errors.New("unrecognized type")
		}
	},
	Encoders: cmds.EncoderMap{
		cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, out *filesLsOutput) error {
			noSort, _ := req.Options[dontSortOptionName].(bool)
			if !noSort {
				slices.SortFunc(out.Entries, func(a, b mfs.NodeListing) int {
					return strings.Compare(a.Name, b.Name)
				})
			}

			long, _ := req.Options[longOptionName].(bool)
			for _, o := range out.Entries {
				if long {
					if o.Type == int(mfs.TDir) {
						o.Name += "/"
					}
					fmt.Fprintf(w, "%s\t%s\t%d\n", o.Name, o.Hash, o.Size)

View on GitHub (pinned to 329838acdf)

Solutions

  1. Retry the listing; the MFS tree may be in a transient state
  2. Restart the daemon to rebuild the MFS root from the filesystem
  3. Report persistent occurrences to the kubo tracker
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at core/commands/files.go:777 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/da842551c280cbfe. Report an issue: GitHub.