ipfs/kubo · error

unexpected non-stream passed to PostRun: please file a bugre

Error message

unexpected non-stream passed to PostRun: please file a bugreport

What it means

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.

Source

Thrown at core/commands/dag/export.go:238

		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.APIDagService
	ctx context.Context
}

func (ds *dagStore) Get(ctx context.Context, key string) ([]byte, error) {
	if ctx.Err() != nil {
		return nil, ctx.Err()

View on GitHub (pinned to 329838acdf)

Solutions

  1. File a bugreport at https://github.com/ipfs/kubo/issues with the command and versions.
  2. Bypass any custom HTTP client/proxy and call the daemon API directly with the official `ipfs` CLI.
  3. Confirm CLI and daemon versions match and that no patched encoders are in play.
  4. 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.
Defensive patterns

Strategy: try-catch

Try / catch

if strings.Contains(err.Error(), "unexpected non-stream passed to PostRun") {
    // bypass proxies/custom clients; report to github.com/ipfs/kubo/issues
}

Prevention

When it happens

Trigger: 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`.

Common situations: 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.

Related errors


AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03). Data as JSON: /api/errors/35e7a610a469f260. Report an issue: GitHub.