New sonar scanner error on unchanged file

  • SCM used: Bitbucket Cloud
  • CI system used: Jenkins
  • Scanner command used when applicable (private details masked):
<masked>/sonar-scanner-6.2.1.4610-windows-x64/bin/sonar-scanner.bat -D"project.settings=<masked>-sonarqube.properties"  -D"sonar.host.url=https://sonarcloud.io"  -D"sonar.token=<masked>"  -D"sonar.cfamily.build-wrapper-output=<masked>/sonar_build_wrapper_output"
  • Languages of the repository: C/C++
  • Error observed:
11:33:59.717949500 ERROR 
An error occurred while analyzing the following compilation unit: 
  <root-file-path>/Query.cpp
A file named "sonar-cfamily-reproducer.tar.xz" has been generated to help the problem investigation.
Please contact SonarSource support providing the following file to help improving the analyzer:
  <root-file-path>\sonar-cfamily-reproducer.tar.xz

java.lang.IllegalStateException: 
An error occurred while analyzing the following compilation unit: 
  <root-file-path>/Query.cpp
A file named "sonar-cfamily-reproducer.tar.xz" has been generated to help the problem investigation.
Please contact SonarSource support providing the following file to help improving the analyzer:
  <root-file-path>\sonar-cfamily-reproducer.tar.xz

	at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:274)
	at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:184)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:63)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:75)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:51)
	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:64)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:192)
	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:188)
	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:159)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
	at org.sonar.scanner.bootstrap.ScannerContainer.doAfterStart(ScannerContainer.java:416)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:128)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
	at org.sonar.scanner.bootstrap.ScannerMain.runScannerEngine(ScannerMain.java:135)
	at org.sonar.scanner.bootstrap.ScannerMain.run(ScannerMain.java:52)
	at org.sonar.scanner.bootstrap.ScannerMain.main(ScannerMain.java:38)
  • Steps to reproduce: Unknown but consistently fails on this file in automation despite no changes in it recently. Have checked old git tags and it suddenly fails there too despite working fine when they were created. Have tried the latest build wrapper and scanner tools. Can share more details privately.
  • Potential workaround: None found, scanning disabled to unblock dev work.

Hi @robmcgee ,

I am sending you a private message where you can share the sonar-cfamily-reproducer.tar.xz so we can reproduce it on our side.

You don’t need to disable the whole analysis, you can try to exclude just that file using sonar.exclusions property, you can see it usage in the documentation page.

1 Like

Hi @robmcgee,

Thanks to the reproducer you’ve provided, I’ve been able to identify the issue. I created a ticket, and I’ve been working on a fix.

Thank you!

1 Like

Great, thanks.
Do we need to grab the latest scanner tools to get the fix or was it on your end?

Hi @robmcgee,

Since you seem to be using SonarQube Cloud, and unless you do very unusual, you don’t have to do anything to get the updated version; it should be automatically uploaded during analysis.

If you have doubts and want to check, you can look in your verbose logs for something like:

INFO CFamily plugin version: 6.xx.x.xxxxx (xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)

The first xx group should be at least 61 to benefit from the fix.