ipfs/kubo · error

unknown event type

Error message

unknown event type

What it means

The add command consumes events from the Unixfs Add events channel and expects every event to be a *coreiface.AddEvent. Any other concrete type on the channel indicates an internal contract violation between the adder implementation and this command, so it fails fast rather than misreport output.

Source

Thrown at core/commands/add.go:638

					nodeAdded, err = api.Dag().Get(req.Context, pathAdded.RootCid())
					if err != nil {
						errCh <- err
						return
					}
					err = mfs.PutNode(ipfsNode.FilesRoot, toFilesDst, nodeAdded)
					if err != nil {
						errCh <- fmt.Errorf("%s: cannot put node in path %q: %w", toFilesOptionName, toFilesDst, err)
						return
					}
					fileAddedToMFS = true
				}
				errCh <- err
			}()

			for event := range events {
				output, ok := event.(*coreiface.AddEvent)
				if !ok {
					return errors.New("unknown event type")
				}

				h := ""
				if (output.Path != path.ImmutablePath{}) {
					h = enc.Encode(output.Path.RootCid())
				}

				if !dir && addit.Name() != "" {
					output.Name = addit.Name()
				} else {
					output.Name = gopath.Join(addit.Name(), output.Name)
				}

				output.Mode = addit.Node().Mode()
				if ts := addit.Node().ModTime(); !ts.IsZero() {
					output.Mtime = addit.Node().ModTime().Unix()
					output.MtimeNsecs = addit.Node().ModTime().Nanosecond()
				}

View on GitHub (pinned to 329838acdf)

Solutions

  1. Upgrade to matching kubo/boxo versions (rebuild with `make build` after `go get github.com/ipfs/boxo@<sha>`)
  2. Remove any custom plugins or patched importers altering the events channel
  3. Report a bug with reproduction steps if triggered by a stock build
Defensive patterns

Strategy: type-guard

Type guard

output, ok := event.(*coreiface.AddEvent)
if !ok {
    return fmt.Errorf("unknown event type %T", event)
}

Prevention

When it happens

Trigger: The events channel (options.Unixfs.Events) receives a value that is not *coreiface.AddEvent during `ipfs add` — effectively only from a nonstandard/buggy adder implementation or plugin; not reachable from valid user input.

Common situations: Custom builds or forks where a replacement importer emits different event types; version mismatch where a vendored adder emits an extended event type; upstream boxo change altering the event contract.

Related errors


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