java.lang.IllegalStateException error during SonarScanner execution


I have a C++ project on which I ran the build-wrapper and then I ran SonarScanner. The scanner ran for a very long time but ended with a java.lang.IllegalStateException during the scan of one source file in particular.

Here is the call stack
17:25:05.633 ERROR: Error during SonarScanner execution
An error occurred while analyzing the following compilation unit:
A file named “” has been generated to help the problem investigation.
Please contact SonarSource support providing the following file to help improving the analyzer:

    > at com.sonar.cpp.plugin.CFamilySensor.process(
    at com.sonar.cpp.plugin.CFamilySensor.execute(
    at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(
    at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(
    at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(
    at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(
    at org.sonar.core.platform.ComponentContainer.startComponents(
    at org.sonar.core.platform.ComponentContainer.execute(
    at org.sonar.scanner.scan.ProjectScanContainer.scan(
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(
    at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(
    at org.sonar.core.platform.ComponentContainer.startComponents(
    at org.sonar.core.platform.ComponentContainer.execute(
    at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(
    at org.sonar.core.platform.ComponentContainer.startComponents(
    at org.sonar.core.platform.ComponentContainer.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(

I have access to a file that contains info to help improve the analyzer. I would like a description of how I debug and fix this issue. Thanks

I have since used the sonar.exclusions property of the scanner to avoid this exception

Hi @SeanCae, welcome to the community!
Could you please share with us the file in question? You can attach it to this thread, or if you prefer for privacy, you can send it to me through DM. (2.3 MB)
Hi Fred, thanks

Hi @SeanCae,
It’s not completely clear to me at the moment whether there are multiple problems or not, but we face a first issue with the fact that the file in question is encoded as a UTF-16 file with Little Endian Byte Order Mark, which we don’t support.
Are your other files in the same encoding? If not, could you try converting it to the same encoding as the others? If all your files are in the same encoding as that, could you still try to convert this file into UTF-8 without BOM and run the analysis again? If you face the same problem after converting, could you share the newly generated reproducer that might be easier for us to analyze?