{"record":{"id":"52bfe27c179fc176","repo":"ipfs/kubo","slug":"unknown-event-type","errorCode":null,"errorMessage":"unknown event type","messagePattern":"unknown event type","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/add.go","lineNumber":638,"sourceCode":"\t\t\t\t\tnodeAdded, err = api.Dag().Get(req.Context, pathAdded.RootCid())\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\terrCh <- err\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\terr = mfs.PutNode(ipfsNode.FilesRoot, toFilesDst, nodeAdded)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\terrCh <- fmt.Errorf(\"%s: cannot put node in path %q: %w\", toFilesOptionName, toFilesDst, err)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tfileAddedToMFS = true\n\t\t\t\t}\n\t\t\t\terrCh <- err\n\t\t\t}()\n\n\t\t\tfor event := range events {\n\t\t\t\toutput, ok := event.(*coreiface.AddEvent)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn errors.New(\"unknown event type\")\n\t\t\t\t}\n\n\t\t\t\th := \"\"\n\t\t\t\tif (output.Path != path.ImmutablePath{}) {\n\t\t\t\t\th = enc.Encode(output.Path.RootCid())\n\t\t\t\t}\n\n\t\t\t\tif !dir && addit.Name() != \"\" {\n\t\t\t\t\toutput.Name = addit.Name()\n\t\t\t\t} else {\n\t\t\t\t\toutput.Name = gopath.Join(addit.Name(), output.Name)\n\t\t\t\t}\n\n\t\t\t\toutput.Mode = addit.Node().Mode()\n\t\t\t\tif ts := addit.Node().ModTime(); !ts.IsZero() {\n\t\t\t\t\toutput.Mtime = addit.Node().ModTime().Unix()\n\t\t\t\t\toutput.MtimeNsecs = addit.Node().ModTime().Nanosecond()\n\t\t\t\t}","sourceCodeStart":620,"sourceCodeEnd":656,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/add.go#L620-L656","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"output, ok := event.(*coreiface.AddEvent)\nif !ok {\n    return fmt.Errorf(\"unknown event type %T\", event)\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["cli","internal","events","type-assertion"],"backgroundTag":"unexpected-event-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"}