Skip to content

Sync API on Windows: "timed out connecting to named pipe" seconds after the server process already exited #65346

Open

Description

@YevheniiKotyrlo

🔎 Search Terms

SyncRpcChannel, timed out connecting to named pipe, before pipe was ready, sync API, tsserverPath, Windows, named pipe

🕗 Version & Regression Information

  • This is the behavior in every version I tried: 7.0.2, 7.1.0-beta and 7.1.0-dev.20261105.1, on Windows 11 with Node v26.12.1; the connect loop is the same on main at 7502ae1

⏯ Playground Link

https://gist.github.com/YevheniiKotyrlo/b3f9b4e5058e6aa6777f17729b9aad78

💻 Code

import { API } from "typescript/sync";

new API({ tsserverPath: process.execPath }).close();

node --api exits at once. The gist runs it on its own, then the code above, and prints when each step happened. It exits 1 while the defect shows, 0 once the constructor reports the exit as soon as it happens, and 2 if a step before that fails:

npm install
node repro.mjs

🙁 Actual behavior

The constructor waits out its whole retry loop and reports a timeout, not the server's exit (typescript@next):

typescript 7.1.0-dev.20261105.1, node v26.12.1, win32 x64 10.0.26300
node --api exits with code 9 after 0.10 s: C:\Program Files\nodejs\node.exe: bad option: --api
0.0 s: new API({ tsserverPath: process.execPath }) from typescript/sync
C:\Program Files\nodejs\node.exe: bad option: --api
C:\Program Files\nodejs\node.exe: bad option: --cwd
8.8 s: SyncRpcChannel: timed out connecting to named pipe
defect shows: node --api exits after 0.10 s, and new API() reported "SyncRpcChannel: timed out connecting to named pipe" after 8.8 s

🙂 Expected behavior

The constructor fails as soon as the server exits, with Child process exited with code 9 before pipe was ready. A server that is still starting is still waited for.

Additional information about the issue

The loop is 500 tries of openSync, 10 ms apart, with the exitCode check between them:

// Retry openSync until the child creates the named pipe.
let fd: number | undefined;
for (let i = 0; i < 500; i++) {
try {
fd = this.fs.openSync(pipePath, "r+");
break;
}
catch {
if (this.child.exitCode !== null) {
throw new Error(
`Child process exited with code ${this.child.exitCode} before pipe was ready`,
);
}
sleep(10);
}
}
if (fd === undefined) {
this.child.kill();
throw new Error("SyncRpcChannel: timed out connecting to named pipe");

Activity

  1. Princekrcoder commented on Nov 6, 2026

    @Princekrcoder

    Hi, I’d like to take a look at this issue. I’m using Windows 11 and will try to reproduce it locally and investigate the cause. If no one else is working on it, I’d be happy to work on a fix and submit a PR.

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