Sonar Scanner NullPointerException error

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • how is SonarQube deployed: zip, Docker, Helm
  • what are you trying to achieve
  • what have you tried so far to achieve this

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Hi folks,

I’m getting a Sonar Scanner error that I’m not sure how to read or solve, but it’s causing the scan/analysis to fail.

First, though, answers to questions:

  • SonarQube server version: (developer)
  • SonarScanner version:
  • SonarQube is deployed on a local server via ZIP

I’m trying to scan a local repository, and am getting the following SonarScanner execution error:

07:54:40.157 INFO: Project root configuration file: NONE
07:54:40.176 INFO: SonarScanner
07:54:40.176 INFO: Java 11.0.17 Eclipse Adoptium (64-bit)
07:54:40.176 INFO: Linux 5.4.0-146-generic amd64
07:54:40.454 INFO: Analyzing on SonarQube server
07:54:44.701 DEBUG: 'tsconfig.doc.json' indexed with language 'json'
07:54:44.732 INFO: ------------------------------------------------------------------------
07:54:44.733 INFO: ------------------------------------------------------------------------
07:54:44.733 INFO: Total time: 4.595s
07:54:44.762 INFO: Final Memory: 16M/57M
07:54:44.763 INFO: ------------------------------------------------------------------------
07:54:44.763 ERROR: Error during SonarScanner execution
        at org.sonar.api.batch.fs.internal.DefaultIndexedFile.hashCode(
        at org.sonar.api.batch.fs.internal.DefaultInputFile.hashCode(
        at java.base/java.util.HashMap.hash(Unknown Source)
        at java.base/java.util.HashMap.put(Unknown Source)
        at org.sonar.scanner.scan.filesystem.InputComponentStore.put(
        at org.sonar.scanner.scan.filesystem.FileIndexer.indexFile(
        at org.sonar.scanner.scan.filesystem.ProjectFileIndexer$IndexFileVisitor.visitFile(
        at org.sonar.scanner.scan.filesystem.ProjectFileIndexer$IndexFileVisitor.visitFile(
        at java.base/java.nio.file.Files.walkFileTree(Unknown Source)
        at org.sonar.scanner.scan.filesystem.ProjectFileIndexer.indexDirectory(
        at org.sonar.scanner.scan.filesystem.ProjectFileIndexer.indexFiles(
        at org.sonar.scanner.scan.filesystem.ProjectFileIndexer.index(
        at org.sonar.scanner.scan.filesystem.ProjectFileIndexer.indexModulesRecursively(
        at org.sonar.scanner.scan.filesystem.ProjectFileIndexer.index(
        at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(
        at org.sonar.core.platform.SpringComponentContainer.startComponents(
        at org.sonar.core.platform.SpringComponentContainer.execute(
        at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(
        at org.sonar.core.platform.SpringComponentContainer.startComponents(
        at org.sonar.core.platform.SpringComponentContainer.execute(
        at org.sonar.batch.bootstrapper.Batch.doExecute(
        at org.sonar.batch.bootstrapper.Batch.execute(
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(
        at com.sun.proxy.$Proxy0.execute(Unknown Source)
        at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(
        at org.sonarsource.scanner.api.EmbeddedScanner.execute(
        at org.sonarsource.scanner.cli.Main.execute(
        at org.sonarsource.scanner.cli.Main.execute(
        at org.sonarsource.scanner.cli.Main.main(

This has not always been a problem; I last successfully performed a scan 26 days ago. Ever since then, though, I’ve been getting NullPointerException errors.

Help? I don’t know what’s causing the error or how to resolve the issue.


Thanks for reaching out on this issue. I investigated it and the likely cause of this problem is that the scanner is trying to index a file that is not a descendant of the base project. This case should not be possible and I’m not sure what could be triggering it.
I’ve created a ticket to handle the case explicitly and add logging information to help find the source of the problem.
In the meantime, it would help us greatly if you were able to find the source on your project with the information I gave you, or provide us with a way to reproduce it. Thanks.