Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language server startup failed #2417

Closed
QuyenLy73 opened this issue Jan 14, 2020 · 66 comments
Closed

Language server startup failed #2417

QuyenLy73 opened this issue Jan 14, 2020 · 66 comments
Labels
Milestone

Comments

@QuyenLy73
Copy link

Issue Description

PS session fails to start with these errors. I have taken the cert from Start-EditorServices.ps1 and imported into my local machine's Trusted Publisher's store. I confirmed it's there with an expiration date of 5/2/2020. I have also executed this command but nothing happens.

Import-Module $HOME.vscode\extensions\ms-vscode.powershell*\modules\PowerShellEditorServices\PowerShellEditorServices.psd1

1/14/2020 2:47:41 PM [NORMAL] - Language server startup failed.
1/14/2020 2:47:41 PM [ERROR] - The language service could not be started:
1/14/2020 2:47:41 PM [ERROR] - Timed out waiting for session file to appear.

Attached Logs

Follow the instructions in the README about
capturing and sending logs.

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.16299
VSCode 1.41.1
PowerShell Extension Version 2019.12.0

PowerShell Information

Name Value
PSVersion 5.1.16299.1146
PSEdition Desktop
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.16299.1146
BuildVersion 10.0.16299.1146
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand)
Extension Author Version
All-Autocomplete Atishay-Jain 0.0.23
bracket-pair-colorizer-2 CoenraadS 0.0.29
powershell ms-vscode 2019.12.0
python ms-python 2020.1.58038
todo-tree Gruntfuggly 0.0.162
@ghost ghost added the Needs: Triage Maintainer attention needed! label Jan 14, 2020
@rjmholt
Copy link
Contributor

rjmholt commented Jan 14, 2020

1/14/2020 2:47:41 PM [NORMAL] - Language server startup failed.
1/14/2020 2:47:41 PM [ERROR] - The language service could not be started:
1/14/2020 2:47:41 PM [ERROR] - Timed out waiting for session file to appear.

These logs just indicate that the client waited for the server to start and that it didn't. When you try to start the PowerShell extension, does anything flash in the terminal? Unfortunately, because of the way VSCode works, capturing the screen at that moment (like with a video/gif recorder) might be the only way to get any error message there.

I have also executed this command but nothing happens.

You might also have some luck trying to execute the following from cmd:

powershell.exe -NoProfile -NoLogo -ExecutionPolicy Bypass -Command "$PSES_BUNDLE_PATH/PowerShellEditorServices/Start-EditorServices.ps1 -BundledModulesPath $PSES_BUNDLE_PATH -LogPath $SESSION_TEMP_PATH/logs.log -SessionDetailsPath $SESSION_TEMP_PATH/session.json -FeatureFlags @() -AdditionalModules @() -HostName 'My Client' -HostProfileId 'myclient' -HostVersion 1.0.0 -LogLevel Diagnostic"

With the following set inline:

  • $PSES_BUNDLE_PATH: ~\.vscode\extensions\ms-vscode.powershell-2019.12.0\modules
  • $SESSION_TEMP_PATH: An empty temp directory

If that works, it should print a bunch of information and then block at the point where it waits for a client to connect (you should then kill the process, since there won't be a client to connect). If it doesn't work (which is what I'm hoping, since we need to reproduce this error in an environment where we control the terminal process), then you should see the error in the CMD console.

@QuyenLy73
Copy link
Author

The cursor just blinks like it's waiting for something?

@rjmholt
Copy link
Contributor

rjmholt commented Jan 15, 2020

The cursor just blinks like it's waiting for something?

Is this in the Integrated Console after startup? It might be worth trying pressing Enter or entering some input there.

Also see if you're able to run the other command listed above.

@QuyenLy73
Copy link
Author

Actually looks like I didn't wait long enough. There are now 3 files in my temp directory. logs.ext, Start-EditorServices-logs.txt, and session.json. In the Integrated Console in VSCode, the last status is

#-- Waiting for EditorServicesHost to complete execution ---------------------

@rjmholt
Copy link
Contributor

rjmholt commented Jan 15, 2020

In the Integrated Console in VSCode, the last status is

#-- Waiting for EditorServicesHost to complete execution ---------------------

That means it should be ready to go. Do you get a prompt?

@QuyenLy73
Copy link
Author

The PS Integrated Console does not let me type anything in there. It tries to start up with a Starting Powershell message and eventually throws an initialization error which is the Language server startup error that I posted here. I ran the command in a different Powershell terminal session within VS code. I assume this is just the PS on the OS. In this window, I get the Waiting for EditorServicesHost message but I can't type anything after that message. I'm still not able to run any of my PS scripts from within VSCode because it says Cannot Debug or Run Powershell Script until the Powershell session has started.

@rjmholt
Copy link
Contributor

rjmholt commented Jan 15, 2020

There are now 3 files in my temp directory. logs.ext, Start-EditorServices-logs.txt, and session.json

Can you post those files here? (Or send them through by email: see the troubleshooting doc)

I assume this is just the PS on the OS

That's indeed what that is.


From what you've described so far, it sounds like the PowerShell process that runs the server is correctly getting to the point where it's waiting on a client connection but for some reason the client never connects properly. If the logs don't reveal anything, it might be worth trying the preview extension instead, especially since that will be stable within the month.

@QuyenLy73
Copy link
Author

@QuyenLy73
Copy link
Author

Files uploaded. Where do I get the preview extension? I've tried rolling back to an older version but still same issue.

@rjmholt
Copy link
Contributor

rjmholt commented Jan 15, 2020

Where do I get the preview extension?

It's in the VSCode marketplace as powershell-preview. You'll need to uninstall the powershell extension for it to work properly.

@QuyenLy73
Copy link
Author

Unfortunately same issue with the preview version. Might try uninstalling VSCode and re-install.

@QuyenLy73
Copy link
Author

Re-installing VSCode didn't help.

@rjmholt
Copy link
Contributor

rjmholt commented Jan 15, 2020

Can you post of a GIF of the whole VSCode window as the extension starts up?

@rjmholt
Copy link
Contributor

rjmholt commented Jan 15, 2020

The other thing I noticed is that the Windows version you're using (RS3) may be end-of-life. Sometimes these kinds of hang issues that we can't reproduce are caused by changes in Windows fixed by patches.

@QuyenLy73
Copy link
Author

QuyenLy73 commented Jan 15, 2020

The terminal is blank with a Starting Powershell... message at the bottom right. Are you wanting a screenshot of the Output window? Unfortunately I can't control the Windows version. This machine is my work laptop. The Powershell extension is a Microsoft product correct? My next route will have to be to submit a ticket to MS if I can't figure this out myself soon.

@rjmholt
Copy link
Contributor

rjmholt commented Jan 15, 2020

Are you wanting a screenshot of the Output window?

A GIF/video of the startup would be ideal, something that shows the extension load when the first PowerShell file is opened and then the Integrated Console appear and start, right until the last message that you posted earlier is logged. It might not show any new information, but sometimes there's a clue in the greater VSCode window.

Unfortunately I can't control the Windows version. This machine is my work laptop.

In that case I believe RS3 is good until April. But in an enterprise context, sometimes anti-virus or group policy prevent startup. It's not entirely clear how we'd show that, but some users have found they can reproduce the same issue on various work devices with different Windows and PowerShell versions, while also having no problem starting the extension on personal devices. If you find that's the case, we'd be grateful for any data you can provide since this is something that crops up from time to time but is very hard to reproduce.

The Powershell extension is a Microsoft product correct?

This is indeed software developed, maintained and made available by Microsoft. I am a Microsoft engineer.

@QuyenLy73
Copy link
Author

This was working fine before the holiday break. I upgraded to the latest extension recently so not sure what triggered the issue. Could very well be Windows hotfix, GPO, etc... I just need to figure out what exactly. I can try and record VSCode but it pretty much shows me a blank terminal window while it's starting up. I don't see anything else.

@QuyenLy73
Copy link
Author

Any advice on what specific group policy to look for? Isn't this just trying to run a PS script behind the scenes? ie Start-EditorServices.ps1?

@rjmholt
Copy link
Contributor

rjmholt commented Jan 15, 2020

This was working fine before the holiday break. I upgraded to the latest extension recently so not sure what triggered the issue.

Yeah we've heard similar in other cases. Often it seems the extension hasn't changed, or even VSCode (since they're totally separate). But one day it just stops working. Possibly a Windows patch, perhaps more likely a policy rollout.

Isn't this just trying to run a PS script behind the scenes? ie Start-EditorServices.ps1?

Yeah, VSCode starts a child process like powershell.exe -noprofile -nologo -command 'C:\path\to\Start-EditorServices.ps1 ... <parameters for connecting, like named pipe name>'

I can try and record VSCode but it pretty much shows me a blank terminal window while it's starting up. I don't see anything else.

In the absence of other information it could be helpful. It likely won't shed new light, but sometimes there's a clue.

Any advice on what specific group policy to look for?

Unfortunately I don't know very much about GPO or how exactly it could interact with the extension, just that some other users have reported it doing so. I'll try and do some research on it. In the meantime, this issue is marked for triage so I'll discuss it with some other team members tomorrow.

@rjmholt
Copy link
Contributor

rjmholt commented Jan 15, 2020

At the point the extension seems to be stuck, the server has created an ACL'd named pipe and the client should be connecting over that named pipe

@QuyenLy73
Copy link
Author

Hopefully you'll have some more ideas after speaking with your team members. In the meantime I'll look into submitting a MS support case ticket. That way I can talk with someone and do screen sharing.

@SydneyhSmith SydneyhSmith removed Needs: Triage Maintainer attention needed! Issue-Bug A bug to squash. labels Jan 16, 2020
@doug4772
Copy link

doug4772 commented Jan 17, 2020

Any updates on this issue? I am experiencing the same symptoms. The the OP, this also worked prior to the holidays and no longer does. I've even gone as far as installing PS Core 6.2 to test both Windows PS 5.1 and PSC 6. No change in either behavior. Attached are the session logs.

Start-EditorServices-logs.log
logs.log
session.json.txt

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Jan 17, 2020
@TylerLeonhardt
Copy link
Member

@doug4772 Can you give this a go in the PowerShell Preview extension? It has a ton of fixes in it and it might be fixed in that already.

@SydneyhSmith SydneyhSmith added this to the 2.0.0 milestone Jan 30, 2020
@rjmholt
Copy link
Contributor

rjmholt commented Jan 31, 2020

Ok, I've just managed to spin up a fresh RS3 VM with VSCode 1.14.1 and PS 5.1 to try this out. I wasn't able to reproduce a startup freeze with either the current stable extension or the current master build. That may mean that rather than being a Windows bug this is a policy or antivirus issue.

One last resort is to collect a procdump of the frozen process to see where it's stuck. We've tried that in the past and in cases like this it hasn't shown clear results, but might be worth a try anyway.

@ghost
Copy link

ghost commented Feb 15, 2020

This issue is being closed as inactive, if this issue is still occurring it will be re-opened

@ghost ghost added the Resolution-Inactive Will close automatically. label Feb 15, 2020
@ghost ghost closed this as completed Feb 15, 2020
@SlkRck
Copy link

SlkRck commented Mar 31, 2020

I'm receiving the error mentioned above PLUS the fact I cannot open a terminal. I uninstalled VSCode completely, rebooted, reinstalled and before installing any PowerShell extensions, tried to open a terminal and it failed with the error:

The terminal process command 'C:\Program Files\PowerShell\7\pwsh.exe' failed to launch (exit code: {2})

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Mar 31, 2020
@davesbrown
Copy link

Happening on all my PROD api servers now

@SydneyhSmith SydneyhSmith added Issue-Bug A bug to squash. and removed Needs: Maintainer Attention Maintainer attention needed! Resolution-Inactive Will close automatically. Needs-Repro-Info labels Apr 7, 2020
@erobillard
Copy link

Same issue. Started when Code was updated. Neither the last stable version nor the Preview work. Username obfuscated below.

4/22/2020 7:06:42 PM [NORMAL] - Visual Studio Code v1.44.2 64-bit
4/22/2020 7:06:42 PM [NORMAL] - PowerShell Extension v2020.4.0
4/22/2020 7:06:42 PM [NORMAL] - Operating System: Windows 64-bit
4/22/2020 7:06:42 PM [NORMAL] - Language server starting --
4/22/2020 7:06:42 PM [NORMAL] - PowerShell executable: C:\Users\myself.dotnet\tools\pwsh.exe
4/22/2020 7:06:42 PM [NORMAL] - PowerShell args: -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command Import-Module 'c:\Users\myself.vscode\extensions\ms-vscode.powershell-2020.4.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2020.4.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\myself.vscode\extensions\ms-vscode.powershell-2020.4.0\modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath 'c:\Users\myself.vscode\extensions\ms-vscode.powershell-2020.4.0\logs\1587596802-25479203-0f29-4890-bbd5-951e79fadd981587596783837\EditorServices.log' -SessionDetailsPath 'c:\Users\myself.vscode\extensions\ms-vscode.powershell-2020.4.0\sessions\PSES-VSCode-17948-194532' -FeatureFlags @()
4/22/2020 7:06:42 PM [NORMAL] - PowerShell Editor Services args: Import-Module 'c:\Users\myself.vscode\extensions\ms-vscode.powershell-2020.4.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2020.4.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\myself.vscode\extensions\ms-vscode.powershell-2020.4.0\modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath 'c:\Users\myself.vscode\extensions\ms-vscode.powershell-2020.4.0\logs\1587596802-25479203-0f29-4890-bbd5-951e79fadd981587596783837\EditorServices.log' -SessionDetailsPath 'c:\Users\myself.vscode\extensions\ms-vscode.powershell-2020.4.0\sessions\PSES-VSCode-17948-194532' -FeatureFlags @()
4/22/2020 7:06:42 PM [NORMAL] - pwsh.exe started.
4/22/2020 7:06:42 PM [NORMAL] - Waiting for session file
4/22/2020 7:08:42 PM [NORMAL] - Error occurred retrieving session file:
Timed out waiting for session file to appear.
4/22/2020 7:08:42 PM [NORMAL] - Language server startup failed.
4/22/2020 7:08:42 PM [ERROR] - The language service could not be started:
4/22/2020 7:08:42 PM [ERROR] - Timed out waiting for session file to appear.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Apr 22, 2020
@TylerLeonhardt
Copy link
Member

Do you run any privilege management software like BeyondTrust?

@TylerLeonhardt TylerLeonhardt removed the Needs: Maintainer Attention Maintainer attention needed! label Apr 22, 2020
@ahohenschuh
Copy link

ahohenschuh commented May 5, 2020

I have the same problem that Posh 5.1 crashes with "The language service could not be started" in vscode. Posh7 works.

vscode-powershell.log

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label May 5, 2020
@TylerLeonhardt
Copy link
Member

I have the same problem that Posh 5.1 crashes with "The language service could not be started" in vscode. Posh7 works.

vscode-powershell.log

Do you run any privilege management software like BeyondTrust?

@SydneyhSmith SydneyhSmith removed the Needs: Maintainer Attention Maintainer attention needed! label May 5, 2020
@mkanet
Copy link

mkanet commented Nov 22, 2020

So.. what's the solution to this issue? It just started happening today on my main PC. Surely with this many people having this issue, there has to be a way to fix it.

I'm using Windows 10 Version 2004 (OS Build 19041.630) using PowerShell 5.1. I've tried both the PowerShell Preview extension as well as the regular PowerShell Extension.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Nov 22, 2020
@sweenb1
Copy link

sweenb1 commented Feb 10, 2021

Also getting this issue in VS Code:
10/2/2021 12:15:52 [NORMAL] - Visual Studio Code v1.53.1 64-bit
10/2/2021 12:15:52 [NORMAL] - PowerShell Extension v2020.6.0
10/2/2021 12:15:52 [NORMAL] - Operating System: Windows 64-bit
10/2/2021 12:15:52 [NORMAL] - Language server starting --
10/2/2021 12:15:52 [NORMAL] - PowerShell executable: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
10/2/2021 12:15:52 [NORMAL] - PowerShell args: -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command Import-Module 'c:\Users*.vscode\extensions\ms-vscode.powershell-2020.6.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2020.6.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users*.vscode\extensions\ms-vscode.powershell-2020.6.0\modules' -EnableConsoleRepl -StartupBanner "=====> PowerShell Integrated Console v2020.6.0 <=====
" -LogLevel 'Normal' -LogPath 'c:\Users*
.vscode\extensions\ms-vscode.powershell-2020.6.0\logs\1612959352-1492f77d-a1fb-4083-82da-059fc7ae41d31612959230672\EditorServices.log' -SessionDetailsPath 'c:\Users*.vscode\extensions\ms-vscode.powershell-2020.6.0\sessions\PSES-VSCode-19512-642239' -FeatureFlags @()
10/2/2021 12:15:52 [NORMAL] - PowerShell Editor Services args: Import-Module 'c:\Users*
.vscode\extensions\ms-vscode.powershell-2020.6.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2020.6.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users*.vscode\extensions\ms-vscode.powershell-2020.6.0\modules' -EnableConsoleRepl -StartupBanner "=====> PowerShell Integrated Console v2020.6.0 <=====
" -LogLevel 'Normal' -LogPath 'c:\Users*
.vscode\extensions\ms-vscode.powershell-2020.6.0\logs\1612959352-1492f77d-a1fb-4083-82da-059fc7ae41d31612959230672\EditorServices.log' -SessionDetailsPath 'c:\Users***.vscode\extensions\ms-vscode.powershell-2020.6.0\sessions\PSES-VSCode-19512-642239' -FeatureFlags @()
10/2/2021 12:15:52 [NORMAL] - powershell.exe started.
10/2/2021 12:15:52 [NORMAL] - Waiting for session file
10/2/2021 12:19:52 [NORMAL] - Timed out waiting for session file to appear.
10/2/2021 12:19:52 [NORMAL] - Language server startup failed.
10/2/2021 12:19:52 [ERROR] - The language service could not be started:
10/2/2021 12:19:52 [ERROR] - Error: Timed out waiting for session file to appear.

Powershell version is 5.1.17763.1490

@mmunchandersen
Copy link

I'm getting this on a Window 2013R2 server. Anyone with a solution?

29.9.2021 21.08.33 [NORMAL] - Visual Studio Code v1.60.2 64-bit
29.9.2021 21.08.34 [NORMAL] - PowerShell Extension v2021.9.0
29.9.2021 21.08.34 [NORMAL] - Operating System: Windows 64-bit
29.9.2021 21.08.34 [NORMAL] - Language server starting --
29.9.2021 21.08.34 [NORMAL] - PowerShell executable: C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
29.9.2021 21.08.34 [NORMAL] - PowerShell args: -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command Import-Module 'c:\Users\Administrator.vscode\extensions\ms-vscode.powershell-2021.9.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2021.9.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\Administrator.vscode\extensions\ms-vscode.powershell-2021.9.0\modules' -EnableConsoleRepl -StartupBanner '=====> PowerShell Integrated Console v2021.9.0 <=====
' -LogLevel 'Normal' -LogPath 'c:\Users\Administrator.vscode\extensions\ms-vscode.powershell-2021.9.0\logs\1632942514-d5eecef5-00e9-478c-8d45-2edb094747141632942501054\EditorServices.log' -SessionDetailsPath 'c:\Users\Administrator.vscode\extensions\ms-vscode.powershell-2021.9.0\sessions\PSES-VSCode-4128-329853' -FeatureFlags @()
29.9.2021 21.08.34 [NORMAL] - PowerShell Editor Services args: Import-Module 'c:\Users\Administrator.vscode\extensions\ms-vscode.powershell-2021.9.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2021.9.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\Administrator.vscode\extensions\ms-vscode.powershell-2021.9.0\modules' -EnableConsoleRepl -StartupBanner '=====> PowerShell Integrated Console v2021.9.0 <=====
' -LogLevel 'Normal' -LogPath 'c:\Users\Administrator.vscode\extensions\ms-vscode.powershell-2021.9.0\logs\1632942514-d5eecef5-00e9-478c-8d45-2edb094747141632942501054\EditorServices.log' -SessionDetailsPath 'c:\Users\Administrator.vscode\extensions\ms-vscode.powershell-2021.9.0\sessions\PSES-VSCode-4128-329853' -FeatureFlags @()
29.9.2021 21.08.34 [NORMAL] - powershell.exe started.
29.9.2021 21.08.34 [NORMAL] - Waiting for session file
29.9.2021 21.12.37 [NORMAL] - Timed out waiting for session file to appear.
29.9.2021 21.12.37 [NORMAL] - Language server startup failed.
29.9.2021 21.12.37 [ERROR] - The language service could not be started:
29.9.2021 21.12.37 [ERROR] - Error: Timed out waiting for session file to appear.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Sep 29, 2021
@ghost
Copy link

ghost commented Sep 29, 2021

Thank you for your comment, but please note that this issue has been closed for over a week. For better visibility, consider opening a new issue with a link to this instead.

@andyleejordan andyleejordan removed the Needs: Maintainer Attention Maintainer attention needed! label Mar 15, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests