Skip to content

node errors: four ERR_* message templates differ from Node's text #43520

Closed as not planned

Description

@robobun

What happens

Four Node error codes have a message template in src/jsc/bindings/ErrorCode.cpp that differs from the template in Node's lib/internal/errors.js (node v26.3.0). The error code and the error class are correct. Only .message differs.

code bun 1.4.3-canary.1+367d939d9 node v26.3.0
ERR_HTTP_SOCKET_ASSIGNED Socket already assigned ServerResponse has an already assigned socket
ERR_TLS_INVALID_PROTOCOL_VERSION TLSv9 is not a valid minimum TLS protocol version "TLSv9" is not a valid minimum TLS protocol version
ERR_TLS_PROTOCOL_VERSION_CONFLICT the template uses %s for both values TLS protocol version "TLSv1.2" conflicts with secureProtocol "TLSv1_2_method"
ERR_IPC_CHANNEL_CLOSED Channel closed. in the template. child.send() after child.disconnect() gives Subprocess.send() can only be used if an IPC channel is open. Channel closed

Repro

const tls = require("node:tls");
const http = require("node:http");
const { EventEmitter } = require("node:events");

function capture(fn) {
  try {
    fn();
  } catch (e) {
    return `${e.code} | ${e.name} | ${e.message}`;
  }
  return "no throw";
}

console.log(capture(() => tls.createSecureContext({ minVersion: "TLSv9" })));
console.log(capture(() => tls.createSecureContext({ minVersion: "TLSv1.2", secureProtocol: "TLSv1_2_method" })));
console.log(capture(() => {
  const socket = new EventEmitter();
  new http.ServerResponse({}).assignSocket(socket);
  new http.ServerResponse({}).assignSocket(socket);
}));

node v26.3.0:

ERR_TLS_INVALID_PROTOCOL_VERSION | TypeError | "TLSv9" is not a valid minimum TLS protocol version
ERR_TLS_PROTOCOL_VERSION_CONFLICT | TypeError | TLS protocol version "TLSv1.2" conflicts with secureProtocol "TLSv1_2_method"
ERR_HTTP_SOCKET_ASSIGNED | Error | ServerResponse has an already assigned socket

bun 1.4.3-canary.1+367d939d9:

ERR_TLS_INVALID_PROTOCOL_VERSION | TypeError | TLSv9 is not a valid minimum TLS protocol version
no throw
ERR_HTTP_SOCKET_ASSIGNED | Error | Socket already assigned

For ERR_IPC_CHANNEL_CLOSED:

const cp = require("node:child_process");
if (process.argv[2] === "child") {
  setTimeout(() => {}, 1000);
} else {
  const child = cp.fork(__filename, ["child"]);
  child.disconnect();
  child.send("x", e => {
    console.log(e.code, JSON.stringify(e.message));
    child.kill();
  });
}

node prints ERR_IPC_CHANNEL_CLOSED "Channel closed". bun prints ERR_IPC_CHANNEL_CLOSED "Subprocess.send() can only be used if an IPC channel is open.".

Notes

  • Node formats the two TLS values with %j (JSON.stringify), so it quotes them. The simpleErrorMessages table in ErrorCode.cpp has only %s-style pieces.
  • The second repro line also shows that bun does not throw ERR_TLS_PROTOCOL_VERSION_CONFLICT for that option pair at all.
  • Two tests hold the current text: test/js/node/http/node-http.test.ts (toThrow("Socket already assigned")) and the first test of test/js/node/errors/error-code-messages.test.ts (the TLS message).
  • The ported test/js/node/test/parallel/test-child-process-send-after-close.js has its upstream message: 'Channel closed' assertion commented out.
  • How I found them: a script compared the constant and table-driven messages in ErrorCode.cpp with the literal templates in Node's lib/internal/errors.js. 108 of 118 are identical. ERR_INSPECTOR_ALREADY_CONNECTED and ERR_INSPECTOR_COMMAND have a different template but give the same output. node: give seven ERR_* codes Node's message text #43502 fixes a related class: call sites whose arguments do not fit the template.

Activity

  1. robobun commented on Sep 19, 2026

    @robobun
    CollaboratorAuthor

    Reproduced on main (26e7a4b): the four messages differ from node v26.3.0, and the secureProtocol conflict does not throw.
    Fix in progress: #43594

  2. added
    bugSomething isn't working
    node.jsCompatibility with Node.js APIs
    on Sep 20, 2026
  3. Jarred-Sumner commented on Oct 8, 2026

    @Jarred-Sumner
    Collaborator

    Use handoff tool. GitHub issues are for user-facing issues and a user did not run into this issue

  4. added a commit that references this issue on Oct 10, 2026
    6c1eb06
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

    bugSomething isn't workingnode.jsCompatibility with Node.js APIs

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions