ipfs/kubo · error
unexpected multipart response during emit, please file a bug
Error message
unexpected multipart response during emit, please file a bugreport
What it means
In `finishCLIExport` (PostRun for `ipfs dag export`), the multipart response reader iterates over response parts. Since a CAR export should stream exactly one binary part, encountering a second multipart part after one was already processed indicates a protocol/encoding bug in the command framework, so it aborts with `CloseWithError` and asks the user to file a bugreport.
Source
Thrown at core/commands/dag/export.go:232
bar := pb.New64(0).Set(pb.Bytes, true).SetWriter(os.Stderr).SetRefreshRate(500 * time.Millisecond)
bar.SetTemplateString(progressBarTemplate)
bar.Start()
var processedOneResponse bool
for {
v, err := res.Next()
if err != nil {
if errors.Is(err, io.EOF) {
// We only write the final bar update on success
// On error it looks too weird
bar.Finish()
return re.Close()
}
return re.CloseWithError(err)
}
if processedOneResponse {
return re.CloseWithError(errors.New("unexpected multipart response during emit, please file a bugreport"))
}
r, ok := v.(io.Reader)
if !ok {
// some sort of encoded response, this should not be happening
return errors.New("unexpected non-stream passed to PostRun: please file a bugreport")
}
processedOneResponse = true
if err = re.Emit(bar.NewProxyReader(r)); err != nil {
return err
}
}
}
type dagStore struct {
dag iface.APIDagServiceView on GitHub (pinned to 329838acdf)
Solutions
- File a bugreport at https://github.com/ipfs/kubo/issues including kubo version and the exact command.
- Ensure CLI and daemon versions match (`ipfs version` on both).
- Remove any API proxy/middleware that could alter the multipart stream and retry directly against the daemon.
- Retry the export on a fresh invocation to rule out a transient framing issue.
Defensive patterns
Strategy: try-catch
Validate before calling
cliVer, _ := run("ipfs", "version")
daemonVer, _ := run("ipfs", "id") // or check daemon binary version
if cliVer != daemonVer {
log.Println("version mismatch between CLI and daemon")
} Try / catch
if strings.Contains(err.Error(), "unexpected multipart response during emit") {
// capture versions + command, report at github.com/ipfs/kubo/issues
} Prevention
- Keep CLI and daemon on the same kubo version.
- Avoid custom proxies/middleware in front of /api/v0 that rewrite multipart responses.
- Pin kubo versions in CI to avoid mixed-version stacks.
When it happens
Trigger: The RPC layer returns more than one multipart part for a dag export response: a mismatch between the command's `Encoders`/streaming setup and the client's multipart decoding, or a server emitting extra parts it should not.
Common situations: Using a custom RPC client/proxy that re-encodes the response; a kubo version mismatch between CLI and daemon (older daemon, newer CLI or vice versa); proxying the API through a middleware that duplicates parts.
Related errors
- unexpected non-stream passed to PostRun: please file a bugre
- ipfs api address could not be found
- unexpected redirect
- unsupported file type '%s'
- cannot parse mode %s: %s
AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03).
Data as JSON: /api/errors/ad81b332ebeda120.
Report an issue: GitHub.