{"record":{"id":"ad81b332ebeda120","repo":"ipfs/kubo","slug":"unexpected-multipart-response-during-emit-please","errorCode":null,"errorMessage":"unexpected multipart response during emit, please file a bugreport","messagePattern":"unexpected multipart response during emit, please file a bugreport","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/dag/export.go","lineNumber":232,"sourceCode":"\tbar := pb.New64(0).Set(pb.Bytes, true).SetWriter(os.Stderr).SetRefreshRate(500 * time.Millisecond)\n\tbar.SetTemplateString(progressBarTemplate)\n\tbar.Start()\n\n\tvar processedOneResponse bool\n\tfor {\n\t\tv, err := res.Next()\n\t\tif err != nil {\n\t\t\tif errors.Is(err, io.EOF) {\n\t\t\t\t// We only write the final bar update on success\n\t\t\t\t// On error it looks too weird\n\t\t\t\tbar.Finish()\n\t\t\t\treturn re.Close()\n\t\t\t}\n\t\t\treturn re.CloseWithError(err)\n\t\t}\n\n\t\tif processedOneResponse {\n\t\t\treturn re.CloseWithError(errors.New(\"unexpected multipart response during emit, please file a bugreport\"))\n\t\t}\n\n\t\tr, ok := v.(io.Reader)\n\t\tif !ok {\n\t\t\t// some sort of encoded response, this should not be happening\n\t\t\treturn errors.New(\"unexpected non-stream passed to PostRun: please file a bugreport\")\n\t\t}\n\n\t\tprocessedOneResponse = true\n\n\t\tif err = re.Emit(bar.NewProxyReader(r)); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n}\n\ntype dagStore struct {\n\tdag iface.APIDagService","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/dag/export.go#L214-L250","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"cliVer, _ := run(\"ipfs\", \"version\")\ndaemonVer, _ := run(\"ipfs\", \"id\") // or check daemon binary version\nif cliVer != daemonVer {\n    log.Println(\"version mismatch between CLI and daemon\")\n}","typeGuard":null,"tryCatchPattern":"if strings.Contains(err.Error(), \"unexpected multipart response during emit\") {\n    // capture versions + command, report at github.com/ipfs/kubo/issues\n}","preventionTips":["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."],"tags":["multipart","rpc","bugreport","protocol-violation"],"backgroundTag":"unexpected-multipart-response","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"}