readable-stream icon indicating copy to clipboard operation
readable-stream copied to clipboard

Is `ERR_MULTIPLE_CALLBACK` missing a `new`?

Open Jarred-Sumner opened this issue 1 year ago • 3 comments

ERR_MULTIPLE_CALLBACK is an Error subclass (eventually) defined here:

https://github.com/nodejs/readable-stream/blob/a2e9aedf4aeee4a5e4d8efcb175edb67e2817eaa/lib/ours/errors.js#L70-L97

In this line, ERR_MULTIPLE_CALLBACK is called instead of constructed:

https://github.com/nodejs/readable-stream/blob/a2e9aedf4aeee4a5e4d8efcb175edb67e2817eaa/lib/internal/streams/writable.js#L594

I ran into this in a difficult to isolate scenario

image

Jarred-Sumner avatar Feb 15 '24 12:02 Jarred-Sumner

Looks like a bug in Node.js: https://github.com/nodejs/node/blob/10c6596f6d7abf7451112e767f8277fcd276d796/lib/internal/streams/writable.js#L879

vweevers avatar Feb 15 '24 12:02 vweevers

@Jarred-Sumner would you like to send a PR? We can't do much about the Node.js source, and we should adapt the code in ours/errors.js to be spawned without new.

A test to repro this would be nice.

mcollina avatar Feb 15 '24 21:02 mcollina

https://github.com/nodejs/node/pull/52110

vweevers avatar Mar 16 '24 09:03 vweevers