ERROR: Error during SonarScanner execution java.lang.IllegalStateException: java.nio.file.NoSuchFile

at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)

at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)

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(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.cli.Main.execute(Main.java:112)

at org.sonarsource.scanner.cli.Main.execute(Main.java:75)

at org.sonarsource.scanner.cli.Main.main(Main.java:61)

Caused by: java.nio.file.NoSuchFileException: /home/Desktop/_work/2/s/cmake_sq/bw_output/build-wrapper-dump.json

at java.base/sun.nio.fs.UnixException.translateToIOException(Unknown Source)

at java.base/sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source)

at java.base/sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source)

at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(Unknown Source)

at java.base/java.nio.file.Files.newByteChannel(Unknown Source)

at java.base/java.nio.file.Files.newByteChannel(Unknown Source)

at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(Unknown Source)

at java.base/java.nio.file.Files.newInputStream(Unknown Source)

at java.base/java.nio.file.Files.newBufferedReader(Unknown Source)

at java.base/java.nio.file.Files.newBufferedReader(Unknown Source)

at com.sonar.cpp.plugin.BuildWrapperJsonReader.getReader(BuildWrapperJsonReader.java:95)

at com.sonar.cpp.plugin.BuildWrapperJsonReader.readCaptures(BuildWrapperJsonReader.java:56)

… 31 more

ERROR:

ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

##[debug]Exit code 1 received from tool ‘/usr/bin/bash’

##[debug]STDIO streams have closed for tool ‘/usr/bin/bash’

##[error]Bash exited with code ‘1’.

##[debug]Processed: ##vso[task.issue type=error;]Bash exited with code ‘1’.

##[debug]task result: Failed

##[debug]Processed: ##vso[task.complete result=Failed;done=true;]

Hi @Shivani,

it seems that you are defining sonar.cfamily.build-wrapper-output to a directory that doesn’t contain the build-wrapper.json.
Did you run the build-wrapper? did it succeed? Did it generate the build-wrapper-dump.json?

For more details, follow our Doc for C and C++ analysis.

we are defining this sonar.cfamily.build-wrapper-output=cmake_sq/bw_output (this is defined in properties file)
and same we use in “/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw_output make -p clean all”

I think this JSON is not getting generated but what is the reason, how it can be generated?? I am not getting any help from sonar documentation, maybe I have limited understanding on this

I checked in the log json file is not generate

@Shivani, Once you execute the build-wrapper. If it is ending successfully, you should have the log and the Json. if you aren’t getting the json, it means build-wrapper execution is failing. Follow the log and the documentation.

@Abbas I don’t see any error for build wrapper in the log the only error I see at “using build wrapper output” as you can see that in my previous screen shot .
I check in document also everything we have in place same setup was working before but somehow past one month scan is failing

@Shivani you aren’t sharing or looking at the log of the build-wrapper execution. You are sharing and pointing to the log of the sonar-scanner execution. Build-wrapper execution should happen before the sonar-scanner and should finish successfully and generate the missing json file.

@Abbas thanks , issue got fixed, and solution : build-wrapper was currupted I reinstalled it and worked.
you can close the issue

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.