Skip to content

stream/iter: push() replaces non-Error signal abort reasons #64797

Description

@trivikr

Version

main

Platform

macOS 26.5.2

Subsystem

stream

What steps will reproduce the bug?

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

const controller = new AbortController();
const reason = 'stop';

const { writer } = push({ signal: controller.signal });
controller.abort(reason);

try {
  await writer.write('data');
} catch (error) {
  console.log('same reason:', error === reason);
  console.log('received:', `${error.name}: ${error.message}`);
}

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

Always

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

it fails with 'stop', as required by Iterable Streams §7.1, Stream.push(), step 12, which says to put the writer into the failed state with the signal’s abort reason.

What do you see instead?

same reason: false
received: AbortError: Aborted

The writer fails with a newly created AbortError, discarding the string abort reason.

Additional information

No response

Metadata

Metadata

Assignees

Labels

streamIssues and PRs related to the stream subsystem.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions