Skip to content

stream/iter: push readable iterator.throw() resolves instead of rejecting #64378

Description

@trivikr

Version

main

Platform

macOS 26.5.2

Subsystem

stream

What steps will reproduce the bug?

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

const { readable } = push();
const iterator = readable[Symbol.asyncIterator]();
const error = new Error('boom');

try {
  const result = await iterator.throw(error);
  console.log('resolved:', result);
} catch (err) {
  console.log('rejected:', err.message);
}

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

Always

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

rejected: boom

The spec says Stream.push() creates a readable whose composed pipeline is aborted “on return or throw (consumer stops iterating)” and cancellation is signaled to the writer. Since this is the iterator throw() path, the provided error should be propagated by rejecting with that error, not converted into a successful completion.

Spec §7.1, step 11

On return or throw (consumer stops iterating), abort pipelineController and signal cancellation to writer.

What do you see instead?

resolved: [Object: null prototype] { done: true, value: undefined }

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