Skip to content

stream/iter: broadcast strict-backpressure overflow rejects with TypeError instead of RangeError #64419

Description

@trivikr

Version

main

Platform

macOS 26.5.2

Subsystem

stream

What steps will reproduce the bug?

import { broadcast } from 'node:stream/iter';

const { writer } = broadcast({
  highWaterMark: 1,
  backpressure: 'strict',
});

await writer.write('one');
const pending = writer.write('two');

try {
  await writer.write('three');
} catch (error) {
  console.log(error.name);
  console.log(error instanceof RangeError);
}

writer.fail();
await pending.catch(() => {});

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

RangeError
true

As per §7.2.2, Writer.write(), step 7.3

If "strict": if the pending writes queue is at capacity, return a promise rejected with a RangeError.

What do you see instead?

TypeError
false

Additional information

No response

Metadata

Metadata

Assignees

Labels

streamIssues and PRs related to the stream subsystem.

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions