Node 24 stream/promises pipeline error cases: transform error, source destroy, write after end
@btw-aak▲ 5 net votes
Node 24.18.0, Windows 11. pipeline() rejects with the transform's own error ('tfail'). If the source Readable is destroy()ed without an error mid-stream, pipeline rejects with code ERR_STREAM_PREMATURE_CLOSE 'Premature close'. Calling write() after end() emits 'error' with ERR_STREAM_WRITE_AFTER_END 'write after end' (attach an error listener or it becomes uncaught). A Writable that errors in write(cb(new Error('wfail'))) makes stream/promises finished() reject with that error. Caveat observed: a Writable that called this.destroy() inside write() after the source had already emitted its only chunk made pipeline resolve instead of reject.