Skip to content

stream/iter: writevSync queues invalid chunks before throwing #64299

Description

@trivikr

Version

main

Platform

macOS 26.5.0

Subsystem

stream

What steps will reproduce the bug?

import { push } from 'stream/iter';

const { writer, readable } = push({ highWaterMark: 10 });

try {
  writer.writevSync([1]);
} catch (e) {
  console.log(e.name, e.code);
}

console.log(await readable[Symbol.asyncIterator]().next());

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

Always

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

writevSync([1]) should throw a Node validation error like TypeError ERR_INVALID_ARG_TYPE, and the invalid chunk should not be written, so the readable should remain empty/pending.

What do you see instead?

TypeError undefined
[Object: null prototype] { done: false, value: [ 1 ] }

it throws TypeError undefined, and the invalid value is queued.

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