Skip to content

πŸ› Bug Report β€” Runtime APIs: console.log()/util.inspect() of a stream shows no state with typescript_implemented_streamsΒ #8048

Closed as not planned

Description

@james-elicx

Description

With typescript_implemented_streams, util.inspect() shows nothing about a stream's state, and neither does console.log(), which uses it. You get ReadableStream {}, WritableStream {} and TransformStream {}. The C++ implementation shows locked, [state], [supportsBYOB] and [length], plus readable/writable for a TransformStream. Logging response.body is a common way to debug a stuck or already-used body. Under the flag it shows nothing useful.

Reproduction

worker.js:

import { inspect } from "node:util";

export default {
  async test() {
    const stream = new ReadableStream({ start(controller) { controller.enqueue(new Uint8Array(3)); } });
    stream.getReader();
    const text = inspect(stream);
    console.log(text);
    console.log(inspect(new TransformStream()));
    console.log(inspect(new Response("body").body));
    if (!text.includes("locked")) throw new Error("inspect() shows none of the stream's state");
  },
};

config.capnp:

using Workerd = import "/workerd/workerd.capnp";

const config :Workerd.Config = (
  services = [(name = "main", worker = .main)],
  # typescript_implemented_streams only starts with this autogate.
  autogates = ["workerd-autogate-per-isolate-javascript-bootstrap"],
);

const main :Workerd.Worker = (
  modules = [(name = "worker", esModule = embed "worker.js")],
  compatibilityDate = "2026-10-27",
  compatibilityFlags = ["typescript_implemented_streams"],
);
workerd test --experimental config.capnp

With the flag (workerd 2026-10-27, @cloudflare/workerd-darwin-arm64@1.20261027.1):

ReadableStream {}
TransformStream {}
ReadableStream {}
[ FAIL ] main

With compatibilityFlags = [] (C++ streams):

ReadableStream {
  locked: true,
  [state]: 'readable',
  [supportsBYOB]: false,
  [length]: undefined
}
TransformStream {
  readable: ReadableStream {
    locked: false,
    [state]: 'readable',
    [supportsBYOB]: false,
    [length]: undefined
  },
  writable: WritableStream { locked: false, [state]: 'writable', [expectsBytes]: false }
}
ReadableStream {
  locked: false,
  [state]: 'readable',
  [supportsBYOB]: true,
  [length]: 4n
}
[ PASS ] main

Expected behavior

inspect()/console.log() of a stream shows the same state as with the C++ implementation, for example through a Symbol.for('nodejs.util.inspect.custom') method on the TypeScript classes.

Activity

  1. james-elicx commented on Oct 27, 2026

    @james-elicx
    MemberAuthor

    Correction: this is already a known, pinned divergence. src/tests/streams/inspect/AGENTS.md records that the TypeScript implementation has no custom inspect and pins both shapes. I missed it because my checkout of src/tests/streams was partial. Closing this as a duplicate of that ledger entry. Sorry for the noise.

  2. jasnell commented on Oct 27, 2026

    @jasnell
    Collaborator

    Yep, known item. I'll be revisiting this but it's not on my critical list before going live.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions