Can't initialize project in VSCode on MacOS

Please provide

  • Operating system: MacOS Sonoma 14.2
  • SonarLint plugin version: 4.2.2
  • Programming language you’re coding in: Python
  • Is connected mode used:
    • Connected to SonarCloud or SonarQube (and which version): SonarQube 10.3.0.82913 (Docker)

And a thorough description of the problem / question:
I’ve created a project in SonarQube and added to SonarLint. Right after the output shows following:

Executing /Users/ralfeus/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-darwin-arm64/jre/21.0.1-macosx-aarch64.tar/bin/java -jar /Users/ralfeus/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-darwin-arm64/server/sonarlint-ls.jar -stdio -analyzers /Users/ralfeus/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-darwin-arm64/analyzers/sonargo.jar /Users/ralfeus/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-darwin-arm64/analyzers/sonarjava.jar /Users/ralfeus/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-darwin-arm64/analyzers/sonarjs.jar /Users/ralfeus/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-darwin-arm64/analyzers/sonarphp.jar /Users/ralfeus/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-darwin-arm64/analyzers/sonarpython.jar /Users/ralfeus/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-darwin-arm64/analyzers/sonarhtml.jar /Users/ralfeus/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-darwin-arm64/analyzers/sonarxml.jar /Users/ralfeus/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-darwin-arm64/analyzers/sonarcfamily.jar /Users/ralfeus/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-darwin-arm64/analyzers/sonartext.jar /Users/ralfeus/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-darwin-arm64/analyzers/sonariac.jar /Users/ralfeus/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-darwin-arm64/analyzers/sonarlintomnisharp.jar
[Warn  - 13:01:06.117] Exception happened during initial sync with project order
[Warn  - 13:01:06.254] Exception happened during initial sync with project order
[Error - 13:01:06.351] Analysis failed
org.sonarsource.sonarlint.core.serverconnection.storage.StorageException: Failed to read file: /Users/ralfeus/.sonarlint/storage/6c6f63616c/projects/6f72646572/component_list.pb
	at org.sonarsource.sonarlint.core.serverconnection.storage.ProtobufFileUtil.readFile(ProtobufFileUtil.java:37)
	at org.sonarsource.sonarlint.core.serverconnection.ComponentsStorage.read(ComponentsStorage.java:35)
	at org.sonarsource.sonarlint.core.serverconnection.ServerConnection.calculatePathPrefixes(ServerConnection.java:140)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.calculatePathPrefixes(ConnectedSonarLintEngineImpl.java:508)
	at org.sonarsource.sonarlint.ls.connected.ProjectBindingManager.computeProjectBinding(ProjectBindingManager.java:218)
	at org.sonarsource.sonarlint.ls.connected.ProjectBindingManager.lambda$getBinding$0(ProjectBindingManager.java:181)
	at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(Unknown Source)
	at org.sonarsource.sonarlint.ls.connected.ProjectBindingManager.getBinding(ProjectBindingManager.java:174)
	at org.sonarsource.sonarlint.ls.connected.ProjectBindingManager.getBinding(ProjectBindingManager.java:142)
	at org.sonarsource.sonarlint.ls.AnalysisTaskExecutor.analyze(AnalysisTaskExecutor.java:192)
	at org.sonarsource.sonarlint.ls.AnalysisTaskExecutor.lambda$analyze$2(AnalysisTaskExecutor.java:161)
	at java.base/java.util.HashMap.forEach(Unknown Source)
	at org.sonarsource.sonarlint.ls.AnalysisTaskExecutor.analyze(AnalysisTaskExecutor.java:161)
	at org.sonarsource.sonarlint.ls.AnalysisTaskExecutor.run(AnalysisTaskExecutor.java:133)
	at org.sonarsource.sonarlint.ls.AnalysisScheduler.lambda$analyzeAsync$1(AnalysisScheduler.java:239)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.nio.file.NoSuchFileException: /Users/ralfeus/.sonarlint/storage/6c6f63616c/projects/6f72646572/component_list.pb
	at java.base/sun.nio.fs.UnixException.translateToIOException(Unknown Source)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source)
	at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(Unknown Source)
	at java.base/java.nio.file.Files.newByteChannel(Unknown Source)
	at java.base/java.nio.file.Files.newByteChannel(Unknown Source)
	at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(Unknown Source)
	at java.base/java.nio.file.Files.newInputStream(Unknown Source)
	at org.sonarsource.sonarlint.core.serverconnection.storage.ProtobufFileUtil.readFile(ProtobufFileUtil.java:34)
	... 19 more

[Warn  - 13:01:06.361] Exception happened during initial sync with project order
[Warn  - 13:01:06.472] Exception happened during initial sync with project order

Also, if i try to refresh SonarLint bindings I get following error:

Error running command SonarLint.UpdateAllBindings: Internal error.. This is likely caused by the extension that contributes SonarLint.UpdateAllBindings.

and the output shows same exceptions as above.

I checked ~/.sonarlint/storage and see it’s empty. I’ve created all folders until files but the error is same. It seems the files can’t be created due to some reason.

If I run sonar-scanner from CLI, it works fine, scans code and communicates to SonarQube

Hello @ralfeus and welcome to the community!

This problem looks like described in this post:
https://community.sonarsource.com/t/exception-happened-during-initial-sync-with-project/104036/6

Please check if the instructions there will help you and get back with the results. Please note that holidays are coming and response might take a bit longer than usual.

Best,
Kirill from SonarLint team.

1 Like

Hi Kirill,
thank you for your response. Indeed replace of project token with user token did help.

2 Likes

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