Line is out of range for file

Hi Sonar team,

We are using sonar cloud and every now and then we have a parsing error in our pipelines like the one bellow:
“##[error]java.lang.IllegalArgumentException: Line 9 is out of range for file [FILE_PATH] File has 8 lines.”

I’m suspect that one possible cause is a race condition between multiple PRs analyzed in the same time on the same project. Please investigate and if you have a solution let me know.

Full call stack:

at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:52)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:126)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:58)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:52)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
##[error]at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
##[error]at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
##[error]at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
##[error]at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
##[error]at org.sonarsource.scanner.cli.Main.main(Main.java:61)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
##[error]ERROR:
ERROR:
##[error]The SonarScanner did not complete successfully
The SonarScanner did not complete successfully
##[error]16:30:08.389 Post-processing failed. Exit code: 1
16:30:08.389 Post-processing failed. Exit code: 1
##[error]The process ‘D:\a\1\s\SonarTemp\scanner\SonarScanner.MSBuild.exe’ failed with exit code 1

Hi @fuzzy_logic

In order to investigate, we would need the debug logs of the analysis.

How do you invoke the scanner ? Yoiu can add the -Dsonar.verbose=true as a parameter.

Thanks
Mickaël