Node-pty: Error launching WinPTY agent: ConnectNamedPipe failed: Windows error 232 at new WindowsPtyAgent

Created on 5 Jul 2018  ·  19Comments  ·  Source: microsoft/node-pty

Environment details

  • OS: Windows

Issue description

polyfills.af71788f6a4543fc4b66.bundle.js:1 Env prod
polyfills.af71788f6a4543fc4b66.bundle.js:1 Assigning new workspace..
polyfills.af71788f6a4543fc4b66.bundle.js:1 C:\Users\ch5174\Desktop
polyfills.af71788f6a4543fc4b66.bundle.js:1 Created terminal with PID: 12836
polyfills.af71788f6a4543fc4b66.bundle.js:1 Closed terminal 12836
polyfills.af71788f6a4543fc4b66.bundle.js:1 Object {httpStatus: 200, data: Object}
polyfills.af71788f6a4543fc4b66.bundle.js:1 ERROR Error: Error launching WinPTY agent: ConnectNamedPipe failed: Windows error 232
at new WindowsPtyAgent (C:\Program Files\Neutrinos Studio\resources\app.asarnode_modules\node-pty\lib\windowsPtyAgent.js:25)
at new WindowsTerminal (C:\Program Files\Neutrinos Studio\resources\app.asarnode_modules\node-pty\lib\windowsTerminal.js:45)
at Object.spawn (C:\Program Files\Neutrinos Studio\resources\app.asarnode_modules\node-pty\lib\index.js:27)
at t.createTerminal (main.ff3549c0f3d7063e2006.bundle.js:1)
at t.ngAfterViewInit (main.ff3549c0f3d7063e2006.bundle.js:1)
at Yi (main.ff3549c0f3d7063e2006.bundle.js:1)
at Ki (main.ff3549c0f3d7063e2006.bundle.js:1)
at Gi (main.ff3549c0f3d7063e2006.bundle.js:1)
at vr (main.ff3549c0f3d7063e2006.bundle.js:1)
at Er (main.ff3549c0f3d7063e2006.bundle.js:1)
console.(anonymous function) @ polyfills.af71788f6a4543fc4b66.bundle.js:1
J @ main.ff3549c0f3d7063e2006.bundle.js:1
WT6e.t.handleError @ main.ff3549c0f3d7063e2006.bundle.js:1
(anonymous) @ main.ff3549c0f3d7063e2006.bundle.js:1
e.invoke @ polyfills.af71788f6a4543fc4b66.bundle.js:1
t.run @ polyfills.af71788f6a4543fc4b66.bundle.js:1
WT6e.t.runOutsideAngular @ main.ff3549c0f3d7063e2006.bundle.js:1
WT6e.t.tick @ main.ff3549c0f3d7063e2006.bundle.js:1
(anonymous) @ main.ff3549c0f3d7063e2006.bundle.js:1
e.invoke @ polyfills.af71788f6a4543fc4b66.bundle.js:1
onInvoke @ main.ff3549c0f3d7063e2006.bundle.js:1
e.invoke @ polyfills.af71788f6a4543fc4b66.bundle.js:1
t.run @ polyfills.af71788f6a4543fc4b66.bundle.js:1
WT6e.t.run @ main.ff3549c0f3d7063e2006.bundle.js:1
next @ main.ff3549c0f3d7063e2006.bundle.js:1
e.object.r @ main.ff3549c0f3d7063e2006.bundle.js:1
OVmG.e.__tryOrUnsub @ main.ff3549c0f3d7063e2006.bundle.js:1
OVmG.e.next @ main.ff3549c0f3d7063e2006.bundle.js:1
OVmG.e._next @ main.ff3549c0f3d7063e2006.bundle.js:1
OVmG.e.next @ main.ff3549c0f3d7063e2006.bundle.js:1
e.next @ main.ff3549c0f3d7063e2006.bundle.js:1
WT6e.e.emit @ main.ff3549c0f3d7063e2006.bundle.js:1
Rt @ main.ff3549c0f3d7063e2006.bundle.js:1
onHasTask @ main.ff3549c0f3d7063e2006.bundle.js:1
e.hasTask @ polyfills.af71788f6a4543fc4b66.bundle.js:1
e._updateTaskCount @ polyfills.af71788f6a4543fc4b66.bundle.js:1
t._updateTaskCount @ polyfills.af71788f6a4543fc4b66.bundle.js:1
t.runTask @ polyfills.af71788f6a4543fc4b66.bundle.js:1
v @ polyfills.af71788f6a4543fc4b66.bundle.js:1
polyfills.af71788f6a4543fc4b66.bundle.js:1 ERROR Error: Error launching WinPTY agent: ConnectNamedPipe failed: Windows error 232
at new WindowsPtyAgent (C:\Program Files\Neutrinos Studio\resources\app.asarnode_modules\node-pty\lib\windowsPtyAgent.js:25)
at new WindowsTerminal (C:\Program Files\Neutrinos Studio\resources\app.asarnode_modules\node-pty\lib\windowsTerminal.js:45)
at Object.spawn (C:\Program Files\Neutrinos Studio\resources\app.asarnode_modules\node-pty\lib\index.js:27)
at t.createTerminal (main.ff3549c0f3d7063e2006.bundle.js:1)
at e._next (main.ff3549c0f3d7063e2006.bundle.js:1)
at e.OVmG.e.__tryOrUnsub (main.ff3549c0f3d7063e2006.bundle.js:1)
at e.OVmG.e.next (main.ff3549c0f3d7063e2006.bundle.js:1)
at e.OVmG.e._next (main.ff3549c0f3d7063e2006.bundle.js:1)
at e.OVmG.e.next (main.ff3549c0f3d7063e2006.bundle.js:1)
at e.next (main.ff3549c0f3d7063e2006.bundle.js:1)
e.invoke @ polyfills.af71788f6a4543fc4b66.bundle.js:1
t.run @ polyfills.af71788f6a4543fc4b66.bundle.js:1
console.(anonymous function) @ polyfills.af71788f6a4543fc4b66.bundle.js:1
J @ main.ff3549c0f3d7063e2006.bundle.js:1
WT6e.t.handleError @ main.ff3549c0f3d7063e2006.bundle.js:1
xn @ main.ff3549c0f3d7063e2006.bundle.js:1
(anonymous) @ main.ff3549c0f3d7063e2006.bundle.js:1
(anonymous) @ main.ff3549c0f3d7063e2006.bundle.js:1
e.invokeTask @ polyfills.af71788f6a4543fc4b66.bundle.js:1
onInvokeTask @ main.ff3549c0f3d7063e2006.bundle.js:1
e.invokeTask @ polyfills.af71788f6a4543fc4b66.bundle.js:1
t.runTask @ polyfills.af71788f6a4543fc4b66.bundle.js:1
t.invokeTask @ polyfills.af71788f6a4543fc4b66.bundle.js:1
p @ polyfills.af71788f6a4543fc4b66.bundle.js:1
h @ polyfills.af71788f6a4543fc4b66.bundle.js:1
polyfills.af71788f6a4543fc4b66.bundle.js:1 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'unsubscribe' of undefined
TypeError: Cannot read property 'unsubscribe' of undefined
at t.ngOnDestroy (main.ff3549c0f3d7063e2006.bundle.js:1)
at Yi (main.ff3549c0f3d7063e2006.bundle.js:1)
at Ki (main.ff3549c0f3d7063e2006.bundle.js:1)
at Gi (main.ff3549c0f3d7063e2006.bundle.js:1)
at Cr (main.ff3549c0f3d7063e2006.bundle.js:1)
at Er (main.ff3549c0f3d7063e2006.bundle.js:1)
at Sr (main.ff3549c0f3d7063e2006.bundle.js:1)
at Object.Cr [as destroyView] (main.ff3549c0f3d7063e2006.bundle.js:1)
at t.WT6e.t.destroy (main.ff3549c0f3d7063e2006.bundle.js:1)
at e.WT6e.e.destroy (main.ff3549c0f3d7063e2006.bundle.js:1)
at t.ngOnDestroy (main.ff3549c0f3d7063e2006.bundle.js:1)
at Yi (main.ff3549c0f3d7063e2006.bundle.js:1)
at Ki (main.ff3549c0f3d7063e2006.bundle.js:1)
at Gi (main.ff3549c0f3d7063e2006.bundle.js:1)
at Cr (main.ff3549c0f3d7063e2006.bundle.js:1)
at Er (main.ff3549c0f3d7063e2006.bundle.js:1)
at Sr (main.ff3549c0f3d7063e2006.bundle.js:1)
at Object.Cr [as destroyView] (main.ff3549c0f3d7063e2006.bundle.js:1)
at t.WT6e.t.destroy (main.ff3549c0f3d7063e2006.bundle.js:1)
at e.WT6e.e.destroy (main.ff3549c0f3d7063e2006.bundle.js:1)
at D (polyfills.af71788f6a4543fc4b66.bundle.js:1)
at D (polyfills.af71788f6a4543fc4b66.bundle.js:1)
at polyfills.af71788f6a4543fc4b66.bundle.js:1
at e.invokeTask (polyfills.af71788f6a4543fc4b66.bundle.js:1)
at Object.onInvokeTask (main.ff3549c0f3d7063e2006.bundle.js:1)
at e.invokeTask (polyfills.af71788f6a4543fc4b66.bundle.js:1)
at t.runTask (polyfills.af71788f6a4543fc4b66.bundle.js:1)
at v (polyfills.af71788f6a4543fc4b66.bundle.js:1)
at
console.(anonymous function) @ polyfills.af71788f6a4543fc4b66.bundle.js:1
J @ main.ff3549c0f3d7063e2006.bundle.js:1
WT6e.t.handleError @ main.ff3549c0f3d7063e2006.bundle.js:1
next @ main.ff3549c0f3d7063e2006.bundle.js:1
e.object.r @ main.ff3549c0f3d7063e2006.bundle.js:1
OVmG.e.__tryOrUnsub @ main.ff3549c0f3d7063e2006.bundle.js:1
OVmG.e.next @ main.ff3549c0f3d7063e2006.bundle.js:1
OVmG.e._next @ main.ff3549c0f3d7063e2006.bundle.js:1
OVmG.e.next @ main.ff3549c0f3d7063e2006.bundle.js:1
e.next @ main.ff3549c0f3d7063e2006.bundle.js:1
WT6e.e.emit @ main.ff3549c0f3d7063e2006.bundle.js:1
(anonymous) @ main.ff3549c0f3d7063e2006.bundle.js:1
e.invoke @ polyfills.af71788f6a4543fc4b66.bundle.js:1
t.run @ polyfills.af71788f6a4543fc4b66.bundle.js:1
WT6e.t.runOutsideAngular @ main.ff3549c0f3d7063e2006.bundle.js:1
onHandleError @ main.ff3549c0f3d7063e2006.bundle.js:1
e.handleError @ polyfills.af71788f6a4543fc4b66.bundle.js:1
t.runGuarded @ polyfills.af71788f6a4543fc4b66.bundle.js:1
e @ polyfills.af71788f6a4543fc4b66.bundle.js:1
n.microtaskDrainDone @ polyfills.af71788f6a4543fc4b66.bundle.js:1
v @ polyfills.af71788f6a4543fc4b66.bundle.js:1

bug

Most helpful comment

Hoping this may help some folks... after excluding various files from real-time scanning I finally found that excluding C:\Users\<your-username>\AppData\Local\hyper\app-<your-version>\resources\app.asar.unpacked\node_modules\node-pty\build\Release\winpty-agent.exe solves this issue for me. You, like me, may feel this is easier than installing replacement binaries.

at least in the default install location.

(Win10 Pro, McAfee LiveSafe, Hyper 2.1.2)

_edit:_ Looks like I replied on the wrong issue. oops.

All 19 comments

@Tyriar We are using xterm which has node-pty dependency and this exception happens once every two or three times.

Dependencies versions:

  1. electron 1.8.2
  2. node-pty 0.7.4
  3. xterm 3.2.0

Environment:
Windows 10, 16gb RAM, Intel i7 processor

@Tyriar You are right. I open it as an administrator. finish it.

@yy7054wyq5 it works only under admin?

@Tyriar Yes.But i found this bug in "vscode".I open "vscode" as an administrator, the bug did't appear. I used "VSCodeUserSetup-x64-1.26.1.exe" to install.

Running vscode as an administrator didn't work for me. I'm using node-pty 0.6.10.
And here are vscode details:-

Version: 1.26.1
Commit: 493869ee8e8a846b0855873886fc79d480d342de
Date: 2018-08-16T18:38:57.434Z
Electron: 2.0.5
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
Architecture: x64

This might be an antivirus problem -- see https://github.com/rprichard/winpty/issues/142. I have reproduced a ConnectNamedPipe failed: Windows error 232 error with the Avast antivirus program initially runs winpty-agent.exe in a sandbox before actually running it. The first agent instance screws up the second one. If you have any third-party antivirus software installed, try (temporarily) disabling it or adding the winpty.dll / winpty-agent.exe programs as exceptions.

@rprichard I don't suppose you have a build of winpty.dll / winpty-agent.exe for 64-bit win that we could give a try using?

I implemented a possible workaround for an antivirus problem in this branch: https://github.com/rprichard/winpty/tree/antivirus. It fixed an ConnectNamedPipe failed: Windows error 232 error with Avast.

Binaries are available here:
https://ci.appveyor.com/project/rprichard/winpty/builds/19509205/artifacts

I'd suggest using the winpty-0.4.4-dev-msvc2015.zip binary (though the same two files in any of the archives ought to work as long as it's the right CPU architecture). Use the zip file's x64/bin subdirectory if your VSCode binaries are 64 bits and ia32/bin otherwise. Copy the winpty.dll / winpty-agent.exe binaries over the ones in VSCode/resources/app/node_modules.asar.unpacked/node-pty/build/Release.

Issue still exists i tried your option. please provide fix asap

For me, this issue ended up being caused by McAfee antivirus flagging ./node_modules/node-pty/winpty-agent.exe as a threat and not allowing it to be used.

This happens even when running as administrator and my only work around was to change the security rules to ignore this file.

We've had pretty good luck running with the files provided by Ryan both for Avast and McAfee. @pappacurds did dropping in the files in the link above not improve matters for you?

Are you running with specific corporate compliance settings or a default McAfee configuration?

@TimWebb it is a corporate environment with much more strict security settings, I solved the issue by telling McAfee to ignore the winpty-agent.exe file that comes packaged in node-pty and it seems to have solved the problem.

I have never experienced this issue on any of my personal computers at home which I do not run McAfee on.

I implemented a possible workaround for an antivirus problem in this branch: https://github.com/rprichard/winpty/tree/antivirus. It fixed an ConnectNamedPipe failed: Windows error 232 error with Avast.

Binaries are available here:
https://ci.appveyor.com/project/rprichard/winpty/builds/19509205/artifacts

I'd suggest using the winpty-0.4.4-dev-msvc2015.zip binary (though the same two files in any of the archives ought to work as long as it's the right CPU architecture). Use the zip file's x64/bin subdirectory if your VSCode binaries are 64 bits and ia32/bin otherwise. Copy the winpty.dll / winpty-agent.exe binaries over the ones in VSCode/resources/app/node_modules.asar.unpacked/node-pty/build/Release.

I can confirm this worked for me :) Thanks very much, appreciate it.

Copied zip files' bin folder contents to \AppData\Local\hyper\app-2.1.2\resources\app.asar.unpackednode_modules\node-pty\build\Release

Started hyper and all looking good.

I could confirm this worked for me too 🥇. Thanks very much, appreciate it.

Hoping this may help some folks... after excluding various files from real-time scanning I finally found that excluding C:\Users\<your-username>\AppData\Local\hyper\app-<your-version>\resources\app.asar.unpacked\node_modules\node-pty\build\Release\winpty-agent.exe solves this issue for me. You, like me, may feel this is easier than installing replacement binaries.

at least in the default install location.

(Win10 Pro, McAfee LiveSafe, Hyper 2.1.2)

_edit:_ Looks like I replied on the wrong issue. oops.

Hoping this may help some folks... after excluding various files from real-time scanning I finally found that excluding C:\Users\<your-username>\AppData\Local\hyper\app-<your-version>\resources\app.asar.unpacked\node_modules\node-pty\build\Release\winpty-agent.exe solves this issue for me. You, like me, may feel this is easier than installing replacement binaries.

at least in the default install location.

(Win10 Pro, McAfee LiveSafe, Hyper 2.1.2)

_edit:_ Looks like I replied on the wrong issue. oops.

This work for me!!!

I'm calling this done as it's now called out in both node-pty and vscode docs.

Was this page helpful?
0 / 5 - 0 ratings