Error in SonarLint for IntelliJ: NullPointerException: Cannot invoke "kotlin.Pair.getFirst"

Environment:

  • Java: JetBrains s.r.o. 17.0.10
  • OS: Linux amd64
  • IDE: IntelliJ IDEA 2023.3.4
  • SonarLint: 10.4.0.77904

Internal error: java.lang.NullPointerException: Cannot invoke “kotlin.Pair.getFirst()” because “rootsPair” is null

java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "kotlin.Pair.getFirst()" because "rootsPair" 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:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.NullPointerException: Cannot invoke "kotlin.Pair.getFirst()" because "rootsPair" is null
	at c.ij.oa.roots.impl.ModuleFileIndexImpl.iterateContent(ModuleFileIndexImpl.java:66)
	at c.ij.oa.roots.impl.FileIndexBase.iterateContent(FileIndexBase.java:33)
	at c.ij.oa.roots.impl.ModuleFileIndexImpl.iterateContent(ModuleFileIndexImpl.java:29)
	at o.sl.ij.SonarLintIntelliJClient.listFilesInContentRoots(SonarLintIntelliJClient.kt:570)
	at o.sl.ij.SonarLintIntelliJClient.listModuleFiles(SonarLintIntelliJClient.kt:530)
	at o.sl.ij.SonarLintIntelliJClient.listFiles(SonarLintIntelliJClient.kt:524)

Hi @Alain_Ramirez_Cabrej, thank you for your report!

The error appears to be coming from IntelliJ, and they fixed it recently. I created this ticket on our side so we avoid this issue from happening, even on previous versions of the IDE. We will try to tackle this as soon as possible.

Environment:

  • Java: JetBrains s.r.o. 17.0.10
  • OS: Windows 11 amd64
  • IDE: IntelliJ IDEA 2023.3.4
  • SonarLint: 10.4.0.77904

Internal error: java.lang.NullPointerException: Cannot invoke “kotlin.Pair.getFirst()” because “rootsPair” is null

java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "kotlin.Pair.getFirst()" because "rootsPair" 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:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.NullPointerException: Cannot invoke "kotlin.Pair.getFirst()" because "rootsPair" is null
	at c.ij.oa.roots.impl.ModuleFileIndexImpl.iterateContent(ModuleFileIndexImpl.java:66)
	at c.ij.oa.roots.impl.FileIndexBase.iterateContent(FileIndexBase.java:33)
	at c.ij.oa.roots.impl.ModuleFileIndexImpl.iterateContent(ModuleFileIndexImpl.java:29)
	at o.sl.ij.SonarLintIntelliJClient.listFilesInContentRoots(SonarLintIntelliJClient.kt:570)
	at o.sl.ij.SonarLintIntelliJClient.listModuleFiles(SonarLintIntelliJClient.kt:530)
	at o.sl.ij.SonarLintIntelliJClient.listFiles(SonarLintIntelliJClient.kt:524)

Environment:

  • Java: JetBrains s.r.o. 17.0.10
  • OS: Mac OS X aarch64
  • IDE: IntelliJ IDEA 2023.3.4
  • SonarLint: 10.4.0.77904

Internal error: java.lang.NullPointerException: Cannot invoke “kotlin.Pair.getFirst()” because “rootsPair” is null

java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "kotlin.Pair.getFirst()" because "rootsPair" 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:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.NullPointerException: Cannot invoke "kotlin.Pair.getFirst()" because "rootsPair" is null
	at c.ij.oa.roots.impl.ModuleFileIndexImpl.iterateContent(ModuleFileIndexImpl.java:66)
	at c.ij.oa.roots.impl.FileIndexBase.iterateContent(FileIndexBase.java:33)
	at c.ij.oa.roots.impl.ModuleFileIndexImpl.iterateContent(ModuleFileIndexImpl.java:29)
	at o.sl.ij.SonarLintIntelliJClient.listFilesInContentRoots(SonarLintIntelliJClient.kt:570)
	at o.sl.ij.SonarLintIntelliJClient.listModuleFiles(SonarLintIntelliJClient.kt:530)
	at o.sl.ij.SonarLintIntelliJClient.listFiles(SonarLintIntelliJClient.kt:524)

We have created a custom SonarLint build that includes a fix to this issue. A bug fix release should be released in the following days, but if it’s a recurring issue, you can already try the build and see if the problem is resolved. To do so, you can follow these steps:

1 Like

Environment:

  • Java: JetBrains s.r.o. 17.0.10
  • OS: Windows 11 amd64
  • IDE: IntelliJ IDEA 2023.3.4
  • SonarLint: 10.4.0.77904

Internal error: java.lang.NullPointerException: Cannot invoke “kotlin.Pair.getFirst()” because “rootsPair” is null

java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "kotlin.Pair.getFirst()" because "rootsPair" 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:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.NullPointerException: Cannot invoke "kotlin.Pair.getFirst()" because "rootsPair" is null
	at c.ij.oa.roots.impl.ModuleFileIndexImpl.iterateContent(ModuleFileIndexImpl.java:66)
	at c.ij.oa.roots.impl.FileIndexBase.iterateContent(FileIndexBase.java:33)
	at c.ij.oa.roots.impl.ModuleFileIndexImpl.iterateContent(ModuleFileIndexImpl.java:29)
	at o.sl.ij.SonarLintIntelliJClient.listFilesInContentRoots(SonarLintIntelliJClient.kt:570)
	at o.sl.ij.SonarLintIntelliJClient.listModuleFiles(SonarLintIntelliJClient.kt:530)
	at o.sl.ij.SonarLintIntelliJClient.listFiles(SonarLintIntelliJClient.kt:524)

Environment:

  • Java: JetBrains s.r.o. 17.0.10
  • OS: Mac OS X aarch64
  • IDE: IntelliJ IDEA 2023.3.4
  • SonarLint: 10.4.0.77904

Internal error: java.lang.NullPointerException: Cannot invoke “kotlin.Pair.getFirst()” because “rootsPair” is null

java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "kotlin.Pair.getFirst()" because "rootsPair" 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:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.NullPointerException: Cannot invoke "kotlin.Pair.getFirst()" because "rootsPair" is null
	at c.ij.oa.roots.impl.ModuleFileIndexImpl.iterateContent(ModuleFileIndexImpl.java:66)
	at c.ij.oa.roots.impl.FileIndexBase.iterateContent(FileIndexBase.java:33)
	at c.ij.oa.roots.impl.ModuleFileIndexImpl.iterateContent(ModuleFileIndexImpl.java:29)
	at o.sl.ij.SonarLintIntelliJClient.listFilesInContentRoots(SonarLintIntelliJClient.kt:570)
	at o.sl.ij.SonarLintIntelliJClient.listModuleFiles(SonarLintIntelliJClient.kt:530)
	at o.sl.ij.SonarLintIntelliJClient.listFiles(SonarLintIntelliJClient.kt:524)

Environment:

  • Java: JetBrains s.r.o. 17.0.10
  • OS: Windows 11 amd64
  • IDE: IntelliJ IDEA 2023.3.5
  • SonarLint: 10.4.0.77904

Internal error: java.lang.NullPointerException: Cannot invoke “kotlin.Pair.getFirst()” because “rootsPair” is null

java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "kotlin.Pair.getFirst()" because "rootsPair" 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:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.NullPointerException: Cannot invoke "kotlin.Pair.getFirst()" because "rootsPair" is null
	at c.ij.oa.roots.impl.ModuleFileIndexImpl.iterateContent(ModuleFileIndexImpl.java:66)
	at c.ij.oa.roots.impl.FileIndexBase.iterateContent(FileIndexBase.java:33)
	at c.ij.oa.roots.impl.ModuleFileIndexImpl.iterateContent(ModuleFileIndexImpl.java:29)
	at o.sl.ij.SonarLintIntelliJClient.listFilesInContentRoots(SonarLintIntelliJClient.kt:570)
	at o.sl.ij.SonarLintIntelliJClient.listModuleFiles(SonarLintIntelliJClient.kt:530)
	at o.sl.ij.SonarLintIntelliJClient.listFiles(SonarLintIntelliJClient.kt:524)

We just released SonarLint version 10.4.1, which contains a fix to this issue. Could you please update your SonarLint and see if all works fine?

Environment:

  • Java: JetBrains s.r.o. 17.0.10
  • OS: Mac OS X aarch64
  • IDE: IntelliJ IDEA 2023.3.4
  • SonarLint: 10.4.0.77904

Internal error: java.lang.NullPointerException: Cannot invoke “kotlin.Pair.getFirst()” because “rootsPair” is null

java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "kotlin.Pair.getFirst()" because "rootsPair" 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:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.NullPointerException: Cannot invoke "kotlin.Pair.getFirst()" because "rootsPair" is null
	at c.ij.oa.roots.impl.ModuleFileIndexImpl.iterateContent(ModuleFileIndexImpl.java:66)
	at c.ij.oa.roots.impl.FileIndexBase.iterateContent(FileIndexBase.java:33)
	at c.ij.oa.roots.impl.ModuleFileIndexImpl.iterateContent(ModuleFileIndexImpl.java:29)
	at o.sl.ij.SonarLintIntelliJClient.listFilesInContentRoots(SonarLintIntelliJClient.kt:570)
	at o.sl.ij.SonarLintIntelliJClient.listModuleFiles(SonarLintIntelliJClient.kt:530)
	at o.sl.ij.SonarLintIntelliJClient.listFiles(SonarLintIntelliJClient.kt:524)