{"record":{"id":"35e7a610a469f260","repo":"ipfs/kubo","slug":"unexpected-non-stream-passed-to-postrun-please-fi","errorCode":null,"errorMessage":"unexpected non-stream passed to PostRun: please file a bugreport","messagePattern":"unexpected non-stream passed to PostRun: please file a bugreport","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/dag/export.go","lineNumber":238,"sourceCode":"\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\n\tctx context.Context\n}\n\nfunc (ds *dagStore) Get(ctx context.Context, key string) ([]byte, error) {\n\tif ctx.Err() != nil {\n\t\treturn nil, ctx.Err()","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/dag/export.go#L220-L256","documentation":"In `finishCLIExport`, after iterating multipart parts, the code type-asserts the response value to `io.Reader` to stream it. If the value is not a reader, the response was decoded/encoded as something else (e.g. JSON), which should never happen for a streaming CAR export command, so it returns this internal-contract-violation error asking for a bugreport.","triggerScenarios":"The dag export response arrives fully buffered/encoded instead of as a raw stream: a proxy or client stack that JSON-encodes responses, or an RPC path where the command's streaming setup was bypassed so `v` is not an `io.Reader`.","commonSituations":"Interposing an HTTP proxy or custom client that re-encodes the `/api/v0/dag/export` response; running a heavily patched or mismatched kubo build where command encoders changed.","solutions":["File a bugreport at https://github.com/ipfs/kubo/issues with the command and versions.","Bypass any custom HTTP client/proxy and call the daemon API directly with the official `ipfs` CLI.","Confirm CLI and daemon versions match and that no patched encoders are in play.","Verify the daemon serves the raw stream: `curl -X POST http://127.0.0.1:5001/api/v0/dag/export?arg=<cid>` should return binary CAR bytes."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if strings.Contains(err.Error(), \"unexpected non-stream passed to PostRun\") {\n    // bypass proxies/custom clients; report to github.com/ipfs/kubo/issues\n}","preventionTips":["Use the official ipfs CLI or client/rpc against the daemon, not re-encoding proxies.","Keep CLI and daemon versions aligned.","Verify raw streaming works via curl against /api/v0/dag/export before adding tooling."],"tags":["streaming","rpc","bugreport","type-mismatch"],"backgroundTag":"unexpected-non-stream-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"}