node-pty icon indicating copy to clipboard operation
node-pty copied to clipboard

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

Open anupvarma opened this issue 8 years ago • 19 comments

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.asar\node_modules\node-pty\lib\windowsPtyAgent.js:25) at new WindowsTerminal (C:\Program Files\Neutrinos Studio\resources\app.asar\node_modules\node-pty\lib\windowsTerminal.js:45) at Object.spawn (C:\Program Files\Neutrinos Studio\resources\app.asar\node_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.asar\node_modules\node-pty\lib\windowsPtyAgent.js:25) at new WindowsTerminal (C:\Program Files\Neutrinos Studio\resources\app.asar\node_modules\node-pty\lib\windowsTerminal.js:45) at Object.spawn (C:\Program Files\Neutrinos Studio\resources\app.asar\node_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

anupvarma avatar Jul 05 '18 11:07 anupvarma

It's failing here https://github.com/Microsoft/node-pty/blob/a3b0a3c9fdfe6fd85005d433a5d6d9124055ec75/src/win/pty.cc#L190

My guess is it's related to user permissions.

Tyriar avatar Jul 05 '18 17:07 Tyriar

@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

ghost avatar Jul 06 '18 05:07 ghost

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

yy7054wyq5 avatar Aug 29 '18 12:08 yy7054wyq5

@yy7054wyq5 it works only under admin?

Tyriar avatar Aug 29 '18 18:08 Tyriar

@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.

yy7054wyq5 avatar Aug 30 '18 08:08 yy7054wyq5

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

sumitparakh avatar Aug 31 '18 15:08 sumitparakh

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 avatar Sep 16 '18 23:09 rprichard

@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?

TimWebb avatar Oct 11 '18 23:10 TimWebb

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.

rprichard avatar Oct 15 '18 09:10 rprichard

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

kishok avatar Oct 26 '18 03:10 kishok

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.

ghost avatar Oct 30 '18 17:10 ghost

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 avatar Oct 30 '18 18:10 TimWebb

@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.

ghost avatar Oct 30 '18 18:10 ghost

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.unpacked\node_modules\node-pty\build\Release

Started hyper and all looking good.

ForauDNB avatar Feb 14 '19 14:02 ForauDNB

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

ychuckt8 avatar Feb 18 '19 21:02 ychuckt8

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.

badZombi avatar Feb 20 '19 15:02 badZombi

@badZombi made a note in the readme: https://github.com/Microsoft/node-pty/commit/4ede4eadabc5c0bbbd14fe465d0395ed467bee3d

Tyriar avatar Mar 03 '19 23:03 Tyriar

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!!!

arsari avatar Apr 03 '19 00:04 arsari

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

Tyriar avatar Apr 12 '19 23:04 Tyriar