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
- Upgrade to matching kubo/boxo versions (rebuild with `make build` after `go get github.com/ipfs/boxo@<sha>`)
- Remove any custom plugins or patched importers altering the events channel
- 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
- Keep kubo and boxo versions in sync when building from source
- Avoid plugins or forks that write into the Unixfs events channel
- Test custom importers against the *coreiface.AddEvent contract
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
- missing option "mhlen"
- core/commands: unexpected type %T, expected *"core/commands"
- dht client does not support GetClosestPeers
- not a file node: %q
- supernode routing was never fully implemented and has been r
AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03).
Data as JSON: /api/errors/52bfe27c179fc176.
Report an issue: GitHub.