Generic issue report reading fails for missing file


  • SonarQube 9.9.1
  • sonar-scanner:
sonar-scanner -v
INFO: Scanner configuration file: /opt/sonar-scanner/conf/
INFO: Project root configuration file: /builds/incharging/iac/
INFO: SonarScanner
INFO: Java 11.0.19 Alpine (64-bit)
INFO: Linux 5.4.241-150.347.amzn2.x86_64 amd64

I’ve identified that for SARIF reports if the sonar.sarifReportPaths=no-file.sarif has a file that doesn’t exist, it will show an error, like:

WARN: Failed to process SARIF report from file 'no-file.sarif', error: 'Failed to read SARIF report at '/builds/incharging/iac/no-file.sarif''

and the sonar-scanner process will finish correctly and upload the others reports to SonarQube.

However, for Generic Reports with a file that doesn’t exists sonar.externalIssuesReportPaths=no-file.json the sonar-scanner fail

ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: Failed to read external issues report '/builds/incharging/iac/no-file.json'
        at org.sonar.scanner.externalissue.ReportParser.parse(
        at org.sonar.scanner.externalissue.ExternalIssuesImportSensor.execute(
        at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(
        at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(
        at org.sonar.core.platform.SpringComponentContainer.startComponents(
        at org.sonar.core.platform.SpringComponentContainer.execute(
        at org.sonar.scanner.scan.SpringProjectScanContainer.scan(
        at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(
        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(
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(
        at java.base/java.lang.reflect.Method.invoke(
        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(
Caused by: java.nio.file.NoSuchFileException: /builds/incharging/iac/no-file.json
        at java.base/sun.nio.fs.UnixException.translateToIOException(
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(
        at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(
        at java.base/java.nio.file.Files.newByteChannel(
        at java.base/java.nio.file.Files.newByteChannel(
        at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(
        at java.base/java.nio.file.Files.newInputStream(
        at java.base/java.nio.file.Files.newBufferedReader(
        at org.sonar.scanner.externalissue.ReportParser.parse(
        ... 31 more
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

Is there an option to ignore non-existing files on externalIssuesReportPaths and not fail the whole sonar-scanner process?


There’s not an option to not fail on missing files in Generic Issue Report processing. It’s a fail-fast mindset.

Why is SARIF processing not also fail-fast? Good question. Perhaps it should be.


Let me share a use case, maybe is easier to understand.

On my pipeline I have a job called sq-send-report to send reports from previous jobs. These jobs generate Generic Issue Report, SARIF each job generate different report format.

The contains:

sonar.externalIssuesReportPaths=job1.json, job2.json

However, the job2 only runs if there are changes on some files, otherwise don’t need to run the scan and generate the reports.

Which means, when the job2 is not included on the pipeline, because no changes on the files job2 files, the sq-send-report fails because the job2.json doesn’t exist.

The same situation I have with job3, however, when the job3 is not included on the pipeline, the sq-send-report doesn’t fail, it just ignore that the job3.sarif doesn’t exist


So it’s not that the reports reference missing files, it’s that the report files are missing.

Yes, this was definitely a fail-fast choice. And again, I’m not sure why it’s inconsistent. I’d say you need to conditionally populate those property values. Perhaps you can pass them on the analysis command line with a dynamic value.


Yes, the report file is missing. It would be nice if sonar.externalIssuesReportPaths have the same behaviour as sonar.sarifReportPaths for ignoring missing report files. I will try to dynamically populate the sonar.externalIssuesReportPaths thanks for the help.

1 Like

Hi again,

I’ve raised this internally, and FYI in future versions we’ll likely fail fast when the SARIF report is missing. The fact that we don’t (yet) was a misunderstanding in the implementation.


thank you in advance, by the way the SARIF is working, the problem is with Generic Reports :slight_smile:


Yes, currently the SARIF failure doesn’t error out analysis. What I’m saying is that it should. And it likely will.


oh ok, so it will break the SARIF job on pipeline as well. I will need to implement a second workaround. Would be possible to add a flag/option to ignore some report files? Or make sonar.sarifReportPaths and
sonar.externalIssuesReportPaths support wildcard?

1 Like