SonarLint fails with multiple exceptions in Eclipse 2024-09

Please provide

  • Operating system: Windows 10
  • SonarLint plugin version: 10.7.0.82276
  • Programming language you’re coding in: Java
  • Is connected mode used: No

And a thorough description of the problem / question:

I am getting dozen of NPE errors in the Console Log and eclipse.log on each file save:

1. NullPointerException

Internal error: java.lang.NullPointerException: Cannot invoke "java.nio.file.Path.getParent()" because "file" is null

java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "java.nio.file.Path.getParent()" because "file" is null
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:649)
	at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.NullPointerException: Cannot invoke "java.nio.file.Path.getParent()" because "file" is null
	at org.sonarsource.sonarlint.core.commons.util.FileUtils.getPathDirectories(FileUtils.java:51)
	at org.sonarsource.sonarlint.core.commons.util.FileUtils.getFileRelativePath(FileUtils.java:42)
	at org.sonarsource.sonarlint.core.commons.SonarLintGitIgnore.getFileRelativePath(SonarLintGitIgnore.java:66)
	at org.sonarsource.sonarlint.core.commons.SonarLintGitIgnore.isIgnored(SonarLintGitIgnore.java:44)
	at org.sonarsource.sonarlint.core.commons.SonarLintGitIgnore.isFileIgnored(SonarLintGitIgnore.java:61)
	at java.base/java.util.function.Predicate.lambda$negate$1(Predicate.java:80)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
	at org.sonarsource.sonarlint.core.analysis.AnalysisService.toInputFiles(AnalysisService.java:777)
	at org.sonarsource.sonarlint.core.analysis.AnalysisService.getAnalysisConfigForEngine(AnalysisService.java:276)
	at org.sonarsource.sonarlint.core.analysis.AnalysisService.analyze(AnalysisService.java:643)
	at org.sonarsource.sonarlint.core.rpc.impl.AnalysisRpcServiceDelegate.lambda$analyzeFilesAndTrack$8(AnalysisRpcServiceDelegate.java:136)
	at org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.lambda$requestAsync$0(AbstractRpcServiceDelegate.java:67)
	at org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.computeWithLogger(AbstractRpcServiceDelegate.java:135)
	at org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.lambda$requestAsync$1(AbstractRpcServiceDelegate.java:65)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
	... 4 common frames omitted

2. .ResponseErrorException

!ENTRY org.sonarlint.eclipse.core 2 0 2024-10-02 00:46:38.251
!MESSAGE Error when executing SonarLint analysis
!STACK 0
java.lang.IllegalStateException: java.util.concurrent.ExecutionException: org.sonarsource.sonarlint.shaded.org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error.
	at org.sonarlint.eclipse.core.internal.jobs.AnalyzeProjectJob.run(AnalyzeProjectJob.java:307)
	at org.sonarlint.eclipse.core.internal.jobs.AnalyzeProjectJob.doRun(AnalyzeProjectJob.java:155)
	at org.sonarlint.eclipse.core.internal.jobs.AbstractSonarJob.run(AbstractSonarJob.java:37)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.util.concurrent.ExecutionException: org.sonarsource.sonarlint.shaded.org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error.
	at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
	at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)
	at org.sonarlint.eclipse.core.internal.utils.JobUtils.waitForFutureInJob(JobUtils.java:74)
	at org.sonarlint.eclipse.core.internal.jobs.AnalyzeProjectJob.run(AnalyzeProjectJob.java:293)
	... 3 more
Caused by: org.sonarsource.sonarlint.shaded.org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error.
	at org.sonarsource.sonarlint.shaded.org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:220)
	at org.sonarsource.sonarlint.shaded.org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:204)
	at org.sonarsource.sonarlint.core.rpc.protocol.SingleThreadedMessageConsumer.lambda$new$0(SingleThreadedMessageConsumer.java:51)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)

This is the full log from the SonarLint Console:

File content changed: /myproject/src/main/java/com/example/MyClass.java
Language of file "file:/D:/projects/myproject/src/main/java/com/example/MyClass.java" is detected to be "JAVA"
Module file event for [uri=file:/D:/projects/myproject/src/main/java/com/example/MyClass.java] has been ignored because it's not a Python file.
Computing file exclusion for uri 'file:/D:/projects/myproject/src/main/java/com/example/MyClass.java'
Trigger: EDITOR_CHANGE
Analysis started with the engines being ready
SonarLint processing file /myproject/src/main/java/com/example/MyClass.java...
Relativizing path: D:\projects\myproject\src\main\java\com\example\MyClass.java for git repo myproject
Internal error: java.lang.NullPointerException: Cannot invoke "java.nio.file.Path.getParent()" because "file" is null

java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "java.nio.file.Path.getParent()" because "file" is null
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:649)
	at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.NullPointerException: Cannot invoke "java.nio.file.Path.getParent()" because "file" is null
	at org.sonarsource.sonarlint.core.commons.util.FileUtils.getPathDirectories(FileUtils.java:51)
	at org.sonarsource.sonarlint.core.commons.util.FileUtils.getFileRelativePath(FileUtils.java:42)
	at org.sonarsource.sonarlint.core.commons.SonarLintGitIgnore.getFileRelativePath(SonarLintGitIgnore.java:66)
	at org.sonarsource.sonarlint.core.commons.SonarLintGitIgnore.isIgnored(SonarLintGitIgnore.java:44)
	at org.sonarsource.sonarlint.core.commons.SonarLintGitIgnore.isFileIgnored(SonarLintGitIgnore.java:61)
	at java.base/java.util.function.Predicate.lambda$negate$1(Predicate.java:80)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
	at org.sonarsource.sonarlint.core.analysis.AnalysisService.toInputFiles(AnalysisService.java:777)
	at org.sonarsource.sonarlint.core.analysis.AnalysisService.getAnalysisConfigForEngine(AnalysisService.java:276)
	at org.sonarsource.sonarlint.core.analysis.AnalysisService.analyze(AnalysisService.java:643)
	at org.sonarsource.sonarlint.core.rpc.impl.AnalysisRpcServiceDelegate.lambda$analyzeFilesAndTrack$8(AnalysisRpcServiceDelegate.java:136)
	at org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.lambda$requestAsync$0(AbstractRpcServiceDelegate.java:67)
	at org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.computeWithLogger(AbstractRpcServiceDelegate.java:135)
	at org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.lambda$requestAsync$1(AbstractRpcServiceDelegate.java:65)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
	... 4 common frames omitted

Error during execution of SonarLint analysis
java.lang.IllegalStateException: java.util.concurrent.ExecutionException: org.sonarsource.sonarlint.shaded.org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error.
	at org.sonarlint.eclipse.core.internal.jobs.AnalyzeProjectJob.run(AnalyzeProjectJob.java:307)
	at org.sonarlint.eclipse.core.internal.jobs.AnalyzeProjectJob.doRun(AnalyzeProjectJob.java:155)
	at org.sonarlint.eclipse.core.internal.jobs.AbstractSonarJob.run(AbstractSonarJob.java:37)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.util.concurrent.ExecutionException: org.sonarsource.sonarlint.shaded.org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error.
	at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
	at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)
	at org.sonarlint.eclipse.core.internal.utils.JobUtils.waitForFutureInJob(JobUtils.java:74)
	at org.sonarlint.eclipse.core.internal.jobs.AnalyzeProjectJob.run(AnalyzeProjectJob.java:293)
	... 3 more
Caused by: org.sonarsource.sonarlint.shaded.org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error.
	at org.sonarsource.sonarlint.shaded.org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:220)
	at org.sonarsource.sonarlint.shaded.org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:204)
	at org.sonarsource.sonarlint.core.rpc.protocol.SingleThreadedMessageConsumer.lambda$new$0(SingleThreadedMessageConsumer.java:51)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)

A post was merged into an existing topic: Error in SonarLint: Cannot invoke “java.nio.file.Path.getParent()” because “file” is null