Couldn't start SonarLint Language Server in VS Code

Windows 10
SonarLint ver 3.7.0
SonarQube ver 8.9.6 (build 50800)

Error on opening vs code: Couldn't start SonarLint Language Server and spawn UNKNOWN error

I was using connected mode but it stopped working for unknown reason. If you try to list Sonarlint Rules I get a spawn UNKNOWN error. Tried uninstall/reinstall extension with no change in symptoms. I also install the extension in IntelliJ. Do not know if that is an issue. but I have uninstalled the SonarLint plugin there as well.

Stack trace from vs code output:

[Error - 4:07:49 PM] Starting client failed

Error: spawn UNKNOWN

at ChildProcess.spawn (node:internal/child_process:412:11)

at spawn (node:child_process:718:9)

at Object.execFile (node:child_process:334:17)

at Object.t.<computed> [as execFile] (node:electron/js2c/asar_bundle:5:2208)

at c:\Users\ME\.vscode\extensions\sonarsource.sonarlint-vscode-3.7.0-win32-x64\dist\extension.js:1:435969

at new Promise (<anonymous>)

at c:\Users\ME\.vscode\extensions\sonarsource.sonarlint-vscode-3.7.0-win32-x64\dist\extension.js:1:435915

at Object.<anonymous> (c:\Users\ME\.vscode\extensions\sonarsource.sonarlint-vscode-3.7.0-win32-x64\dist\extension.js:1:436324)

at (<anonymous>)

at c:\Users\ME\.vscode\extensions\sonarsource.sonarlint-vscode-3.7.0-win32-x64\dist\extension.js:1:433928

at new Promise (<anonymous>)

at r (c:\Users\ME\.vscode\extensions\sonarsource.sonarlint-vscode-3.7.0-win32-x64\dist\extension.js:1:433673)

at Object.t.resolveRequirements (c:\Users\ME\.vscode\extensions\sonarsource.sonarlint-vscode-3.7.0-win32-x64\dist\extension.js:1:434685)

at c:\Users\ME\.vscode\extensions\sonarsource.sonarlint-vscode-3.7.0-win32-x64\dist\extension.js:1:404373

at c:\Users\ME\.vscode\extensions\sonarsource.sonarlint-vscode-3.7.0-win32-x64\dist\extension.js:1:405923

at s.createMessageTransports (c:\Users\ME\.vscode\extensions\sonarsource.sonarlint-vscode-3.7.0-win32-x64\dist\extension.js:1:623585)

at s.createConnection (c:\Users\ME\.vscode\extensions\sonarsource.sonarlint-vscode-3.7.0-win32-x64\dist\extension.js:1:560697)

at s.resolveConnection (c:\Users\ME\.vscode\extensions\sonarsource.sonarlint-vscode-3.7.0-win32-x64\dist\extension.js:1:555897)

at start (c:\Users\ME\.vscode\extensions\sonarsource.sonarlint-vscode-3.7.0-win32-x64\dist\extension.js:1:554040)

at t.activate (c:\Users\ME\.vscode\extensions\sonarsource.sonarlint-vscode-3.7.0-win32-x64\dist\extension.js:1:412274)

at Function._callActivateOptional (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:97:17470)

at Function._callActivate (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:97:17131)

at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:97:14945

at processTicksAndRejections (node:internal/process/task_queues:96:5)

at async b._activate (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:85:8180)

at async b._waitForDepsThenActivate (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:85:8122)

at async b._initialize (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:85:7486) 

I appreciate any input to resolve this issue.

1 Like

I have the same issue!

Hello, thank you both for your feedback.

If I understand correctly, this error arises when SonarLint tries to check that the correct version of Java is available (SonarLint for VSCode requires a Java 11+ runtime to run its language server).

However, I also notice that you are using the Windows-specific build of version 3.7, which embeds its own Java runtime.

I see that Node’s execFile function ends with message Error: spawn UNKNOWN, which doesn’t tell much about why executing the command failed.

Do you use a malware detection software that could prevent the Java runtime from starting? These tools are sometimes a bit strict about the directories they allow programs to run from.

Also, could you please try to execute the command below and make sure that it runs correctly?

c:\Users\ME\.vscode\extensions\sonarsource.sonarlint-vscode-3.7.0-win32-x64\jre\17.0.3-win32-x86_64.tar\bin\java.exe -version

As a workaround, you can try to download the “Universal” VSIX from the extension page instead of the platform-specific one.

Screenshot from 2022-07-27 13-12-54

SonarLint does not have a problem finding the correct Java version. When I first installed SonarLint it kept prompting me to install the bundled version 17 but I do not have admin privs. Support installed JDK v15 and I was able to connect to SonarQube. That stopped the prompting to install the bundled version. The SPAWN errors occur on startup and anytime you click on SonarLint dropdowns such as rules.
You mentioned malware detection and that is installed and I cannot turn it off. Keep in mind though that SonarLint was working so I would not consider the malware monitoring an issue.

Output from the command you sent:

openjdk version "17.0.3" 2022-04-19
OpenJDK Runtime Environment Temurin-17.0.3+7 (build 17.0.3+7)
OpenJDK 64-Bit Server VM Temurin-17.0.3+7 (build 17.0.3+7, mixed mode)

In reference to the Universal VSIX. Are you referring to Visual Studio or Visual Studio Code?

It didn’t work with setting java 17 directly in the sonar settings:

"": "c:\\Program Files\\OpenJDK\\jdk-17.0.2",

But installing the universal plugin seemed to work!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.