What’s happening in the analysis when you get this error? Typically this refers to a coverage report or external issues report referencing a line that doesn’t exist in the file (meaning that file, and whatever is generating it, needs to get fixed).
In any case, if you share more logs, it should be clear where the issue is coming from.
This is more of the log. I hope that helps you further. I am not scanning code coverage in that at all.
2024-02-07T23:14:24.6081703Z 23:14:23.947 DEBUG: Not enough content in '**Obfuscated**AuditHost.cs' to have CPD blocks, it will not be part of the duplication detection
2024-02-07T23:14:24.6082197Z 23:14:23.948 INFO: Importing results from 6 proto files in '/home/runner/_work/amazon/amazon/.sonarqube/out/52/output-cs'
2024-02-07T23:14:24.6082695Z 23:14:23.948 INFO: Importing results from 6 proto files in '/home/runner/_work/amazon/amazon/.sonarqube/out/172/output-cs'
2024-02-07T23:14:24.6082871Z 23:14:23.952 DEBUG: Shutting down the bridge server
2024-02-07T23:14:24.6083003Z 23:14:23.953 DEBUG: The bridge server shut down
2024-02-07T23:14:24.6083175Z 23:14:23.966 DEBUG: The worker thread exited with code 1
2024-02-07T23:14:24.6083428Z 23:14:24.447 ERROR: Error during SonarScanner execution
2024-02-07T23:14:24.6084129Z java.lang.IllegalArgumentException: Line 575 is out of range for file **Obfuscated**Modules//FacilityDetail.razor. File has 386 lines.
2024-02-07T23:14:24.6084420Z at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
2024-02-07T23:14:24.6084787Z at org.sonar.scanner.DefaultFileLinesContext.checkLineRange(DefaultFileLinesContext.java:50)
2024-02-07T23:14:24.6085136Z at org.sonar.scanner.DefaultFileLinesContext.setIntValue(DefaultFileLinesContext.java:43)
2024-02-07T23:14:24.6085561Z at org.sonarsource.dotnet.shared.plugins.protobuf.MetricsImporter.consumeFor(MetricsImporter.java:66)
2024-02-07T23:14:24.6085998Z at org.sonarsource.dotnet.shared.plugins.protobuf.MetricsImporter.consumeFor(MetricsImporter.java:38)
2024-02-07T23:14:24.6086420Z at org.sonarsource.dotnet.shared.plugins.protobuf.ProtobufImporter.consume(ProtobufImporter.java:73)
2024-02-07T23:14:24.6086876Z at org.sonarsource.dotnet.shared.plugins.protobuf.RawProtobufImporter.accept(RawProtobufImporter.java:49)
2024-02-07T23:14:24.6087329Z at org.sonarsource.dotnet.shared.plugins.ProtobufDataImporter.parseProtobuf(ProtobufDataImporter.java:105)
2024-02-07T23:14:24.6087781Z at org.sonarsource.dotnet.shared.plugins.ProtobufDataImporter.importResults(ProtobufDataImporter.java:80)
2024-02-07T23:14:24.6088138Z at org.sonarsource.dotnet.shared.plugins.DotNetSensor.importResults(DotNetSensor.java:104)
2024-02-07T23:14:24.6088493Z at org.sonarsource.dotnet.shared.plugins.DotNetSensor.execute(DotNetSensor.java:82)
2024-02-07T23:14:24.6088845Z at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:62)
2024-02-07T23:14:24.6089202Z at org.sonar.scanner.sensor.ProjectSensorsExecutor.execute(ProjectSensorsExecutor.java:40)
2024-02-07T23:14:24.6089563Z at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:155)
2024-02-07T23:14:24.6089953Z at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
2024-02-07T23:14:24.6090264Z at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
2024-02-07T23:14:24.6090608Z at org.sonar.scanner.bootstrap.ScannerContainer.doAfterStart(ScannerContainer.java:397)
2024-02-07T23:14:24.6090954Z at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
2024-02-07T23:14:24.6091271Z at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
2024-02-07T23:14:24.6091602Z at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:125)
2024-02-07T23:14:24.6091959Z at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
2024-02-07T23:14:24.6092280Z at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
2024-02-07T23:14:24.6092500Z at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:57)
2024-02-07T23:14:24.6092746Z at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:51)
2024-02-07T23:14:24.6093194Z at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
2024-02-07T23:14:24.6093503Z at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2024-02-07T23:14:24.6093898Z at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
2024-02-07T23:14:24.6094337Z at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2024-02-07T23:14:24.6094551Z at java.base/java.lang.reflect.Method.invoke(Method.java:568)
2024-02-07T23:14:24.6094977Z at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
2024-02-07T23:14:24.6095187Z at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
2024-02-07T23:14:24.6095512Z at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
2024-02-07T23:14:24.6095816Z at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
2024-02-07T23:14:24.6096018Z at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
2024-02-07T23:14:24.6096207Z at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
2024-02-07T23:14:24.6096381Z at org.sonarsource.scanner.cli.Main.main(Main.java:62)
2024-02-07T23:14:24.6096677Z 23:14:24.395 INFO: ------------------------------------------------------------------------
2024-02-07T23:14:24.6096778Z 23:14:24.395 INFO: EXECUTION FAILURE
2024-02-07T23:14:24.6097067Z 23:14:24.395 INFO: ------------------------------------------------------------------------
2024-02-07T23:14:24.6097178Z 23:14:24.395 INFO: Total time: 1:37.168s
2024-02-07T23:14:24.6097287Z 23:14:24.447 INFO: Final Memory: 56M/256M
2024-02-07T23:14:24.6097575Z 23:14:24.447 INFO: ------------------------------------------------------------------------
2024-02-07T23:14:24.7881844Z Process returned exit code 1
2024-02-07T23:14:24.7914711Z The SonarScanner did not complete successfully
2024-02-07T23:14:24.7916482Z 23:14:24.791 Post-processing failed. Exit code: 1
2024-02-07T23:14:24.6084129Z java.lang.IllegalArgumentException: Line 575 is out of range for file ObfuscatedModules//FacilityDetail.razor. File has 386 lines.
This is for a Razor file. To get unblocked , you can disable Razor analysis either from the Project Settings
From Administration → General Settings → Languages → C#
Is this issue still persistent for you? If so, can you please provide us the FacilityDetail.razor so we can re-produce the issue on our side?
Thank you.
We are getting the same error on our On-Prem Windows Build Agent. Our project contains multiple .razor files but the error only occurs on _Imports.razor. As a workaround we have added this specific file to the ignore list (in the sonar project settings).
Attached you can find a BugRepro.zip file that contains a reduced version of our _Imports.razor. The file has been renamed to BugRepro.razor. It contains only 2 lines and is encoded as UTF-8 BOM. CRLF is used. When we add this file to our repo the build fails (also changing the file to UTF-8 without BOM did not fix the issue).
Detailed error log:
2024-05-15T11:28:09.2849183Z INFO: SonarScanner 4.8.1.3023
2024-05-15T11:28:09.2929404Z INFO: Java 21.0.3 Oracle Corporation (64-bit)
2024-05-15T11:28:09.2937065Z INFO: Windows Server 2019 10.0 amd64
2024-05-15T11:28:10.1212108Z INFO: Analyzing on SonarQube server 10.3.0.82913
....
2024-05-15T11:29:27.5518540Z INFO: ------------------------------------------------------------------------
2024-05-15T11:29:27.5519083Z INFO: EXECUTION FAILURE
2024-05-15T11:29:27.5519444Z INFO: ------------------------------------------------------------------------
2024-05-15T11:29:27.5725257Z INFO: Total time: 1:18.383s
2024-05-15T11:29:27.6330727Z INFO: Final Memory: 38M/134M
2024-05-15T11:29:27.6331687Z INFO: ------------------------------------------------------------------------
2024-05-15T11:29:27.6337024Z ##[error]ERROR: Error during SonarScanner execution
2024-05-15T11:29:27.6337698Z ERROR: Error during SonarScanner execution
2024-05-15T11:29:27.6338339Z ##[error]java.lang.IllegalArgumentException: Line 4 is out of range for file src/Presentation/Server/BugRepro.razor. File has 2 lines.
2024-05-15T11:29:27.6353999Z java.lang.IllegalArgumentException: Line 4 is out of range for file src/Presentation/Server/BugRepro.razor. File has 2 lines.
2024-05-15T11:29:27.6371935Z ##[error]at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
2024-05-15T11:29:27.6385524Z at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
2024-05-15T11:29:27.6405314Z ##[error]at org.sonar.scanner.DefaultFileLinesContext.checkLineRange(DefaultFileLinesContext.java:63)
2024-05-15T11:29:27.6407266Z at org.sonar.scanner.DefaultFileLinesContext.checkLineRange(DefaultFileLinesContext.java:63)
2024-05-15T11:29:27.6408302Z ##[error]at org.sonar.scanner.DefaultFileLinesContext.setIntValue(DefaultFileLinesContext.java:56)
at org.sonarsource.dotnet.shared.plugins.protobuf.MetricsImporter.consumeFor(MetricsImporter.java:66)
2024-05-15T11:29:27.6409374Z at org.sonar.scanner.DefaultFileLinesContext.setIntValue(DefaultFileLinesContext.java:56)
2024-05-15T11:29:27.6409707Z at org.sonarsource.dotnet.shared.plugins.protobuf.MetricsImporter.consumeFor(MetricsImporter.java:66)
2024-05-15T11:29:27.6410363Z ##[error]at org.sonarsource.dotnet.shared.plugins.protobuf.MetricsImporter.consumeFor(MetricsImporter.java:38)
2024-05-15T11:29:27.6410903Z at org.sonarsource.dotnet.shared.plugins.protobuf.MetricsImporter.consumeFor(MetricsImporter.java:38)
2024-05-15T11:29:27.6411819Z ##[error]at org.sonarsource.dotnet.shared.plugins.protobuf.ProtobufImporter.consume(ProtobufImporter.java:73)
2024-05-15T11:29:27.6412390Z at org.sonarsource.dotnet.shared.plugins.protobuf.ProtobufImporter.consume(ProtobufImporter.java:73)
2024-05-15T11:29:27.6413064Z ##[error]at org.sonarsource.dotnet.shared.plugins.protobuf.RawProtobufImporter.accept(RawProtobufImporter.java:49)
2024-05-15T11:29:27.6413606Z at org.sonarsource.dotnet.shared.plugins.protobuf.RawProtobufImporter.accept(RawProtobufImporter.java:49)
2024-05-15T11:29:27.6414277Z ##[error]at org.sonarsource.dotnet.shared.plugins.ProtobufDataImporter.parseProtobuf(ProtobufDataImporter.java:105)
2024-05-15T11:29:27.6414967Z at org.sonarsource.dotnet.shared.plugins.ProtobufDataImporter.parseProtobuf(ProtobufDataImporter.java:105)
2024-05-15T11:29:27.6415639Z ##[error]at org.sonarsource.dotnet.shared.plugins.ProtobufDataImporter.importResults(ProtobufDataImporter.java:80)
2024-05-15T11:29:27.6416183Z at org.sonarsource.dotnet.shared.plugins.ProtobufDataImporter.importResults(ProtobufDataImporter.java:80)
2024-05-15T11:29:27.6416895Z ##[error]at org.sonarsource.dotnet.shared.plugins.DotNetSensor.importResults(DotNetSensor.java:104)
2024-05-15T11:29:27.6417418Z at org.sonarsource.dotnet.shared.plugins.DotNetSensor.importResults(DotNetSensor.java:104)
2024-05-15T11:29:27.6418194Z ##[error]at org.sonarsource.dotnet.shared.plugins.DotNetSensor.execute(DotNetSensor.java:82)
2024-05-15T11:29:27.6418775Z at org.sonarsource.dotnet.shared.plugins.DotNetSensor.execute(DotNetSensor.java:82)
2024-05-15T11:29:27.6419415Z ##[error]at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
2024-05-15T11:29:27.6419967Z at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
2024-05-15T11:29:27.6420583Z ##[error]at org.sonar.scanner.sensor.ProjectSensorsExecutor.execute(ProjectSensorsExecutor.java:52)
2024-05-15T11:29:27.6421100Z at org.sonar.scanner.sensor.ProjectSensorsExecutor.execute(ProjectSensorsExecutor.java:52)
2024-05-15T11:29:27.6422135Z ##[error]at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:366)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:201)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:180)
2024-05-15T11:29:27.6422913Z at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:366)
2024-05-15T11:29:27.6423257Z at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:201)
2024-05-15T11:29:27.6423581Z at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:180)
2024-05-15T11:29:27.6424213Z ##[error]at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:139)
2024-05-15T11:29:27.6425061Z at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:139)
2024-05-15T11:29:27.6427317Z ##[error]at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:201)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:180)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:71)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:65)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
2024-05-15T11:29:27.6429707Z at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:201)
2024-05-15T11:29:27.6430047Z at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:180)
2024-05-15T11:29:27.6430334Z at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:71)
2024-05-15T11:29:27.6430587Z at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:65)
2024-05-15T11:29:27.6430902Z at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
2024-05-15T11:29:27.6431254Z at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
2024-05-15T11:29:27.6431546Z at java.base/java.lang.reflect.Method.invoke(Method.java:580)
2024-05-15T11:29:27.6431842Z at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
2024-05-15T11:29:27.6432409Z ##[error]at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
2024-05-15T11:29:27.6432867Z at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
2024-05-15T11:29:27.6433580Z ##[error]at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
2024-05-15T11:29:27.6434196Z at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
2024-05-15T11:29:27.6434493Z at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
2024-05-15T11:29:27.6435295Z ##[error]at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
2024-05-15T11:29:27.6435903Z at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
2024-05-15T11:29:27.6436533Z ##[error]at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
2024-05-15T11:29:27.6437026Z at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
2024-05-15T11:29:27.6437572Z ##[error]at org.sonarsource.scanner.cli.Main.main(Main.java:62)
ERROR:
2024-05-15T11:29:27.6438031Z at org.sonarsource.scanner.cli.Main.main(Main.java:62)
This started happening on our scans this morning too. Same issue as above with the _Imports.razor. Disabling razor scanning did not fix the issue, however the workaround from Marcel did - adding it to the ignore list allowed the scanner to complete.
The same here, also starts this morning, also failing on _Imports.razor on all files, what chaned? I didn’t update anything both in projects and in sonar.
Unfortunately, nothing of those 3 suggestions fixed the problem.
First, we have only .NET 8 SDK installed, no preview version
3 additional empty lines didn’t fixed it.
Disable razor file analysis also didn’t fixed it.
This issue started happening suddenly yesterday, even with previously successful builds. We’re using Azure Pipelines with the Ubuntu latest hosted agent, and as far as I know, there is no .NET 9 on there yet. Looking at the logs, the Roslyn version did change from 4.9.0.0 to 4.10.0.0, and Java Eclipse Adoptium (64-bit) went from 17.0.10 to 17.0.11. So, the hosted agent must have had an update.
The workaround to add a couple of new lines followed by a commented-out line solved the error for us. The file in question is the _Imports.razor file used for a Blazor part of our application that only has @using statements.