Error executing sensor: 'CFamily' with java.lang.IllegalStateException: unexpanded response file

  • Operating system: Win 10 21H1 (Build 19043)
  • IDE name and flavor/env: Visual Studio Code with PlatformIO
  • SonarLint plugin version: 3.4.1
  • Is connected mode used: no

I have already opened a ticket on PlatformIO which is my C++ build system because I thought the problem could be located there. As you can see it is not, as the other user can run SonarLint just fine:

It does not matter which project (recently created a new one from scratch), I get the following error from SonarLint:

[Info - 14:47:35.678] Analyzing file 'file:///c:/Users/Inso/Documents/PlatformIO/Projects/Text_SonarLint/src/main.cpp'...
[Info - 14:47:35.684] Index files
[Info - 14:47:35.685] 1 file indexed
[Error - 14:47:35.694] Error executing sensor: 'CFamily'
[Error - 14:47:35.694] java.lang.IllegalStateException: unexpanded response file
    at com.sonar.cpp.analyzer.ClangDriver.onCapture(ClangDriver.java:329)
    at com.sonar.cpp.analyzer.CompilerDrivers.onCapture(CompilerDrivers.java:35)
    at com.sonar.cpp.plugin.SonarLintSensor.lambda$processCompileCommands$1(SonarLintSensor.java:151)
    at java.base/java.util.HashMap.forEach(HashMap.java:1425)
    at com.sonar.cpp.plugin.SonarLintSensor.processCompileCommands(SonarLintSensor.java:145)
    at com.sonar.cpp.plugin.SonarLintSensor.process(SonarLintSensor.java:131)
    at com.sonar.cpp.plugin.SonarLintSensor.execute(SonarLintSensor.java:94)
    at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:169)
    at org.sonarsource.sonarlint.core.analysis.container.analysis.sensor.SensorsExecutor.executeSensor(SensorsExecutor.java:81)
    at org.sonarsource.sonarlint.core.analysis.container.analysis.sensor.SensorsExecutor.execute(SensorsExecutor.java:72)
    at org.sonarsource.sonarlint.core.analysis.container.analysis.AnalysisContainer.doAfterStart(AnalysisContainer.java:122)
    at org.sonarsource.sonarlint.core.plugin.commons.pico.ComponentContainer.startComponents(ComponentContainer.java:119)
    at org.sonarsource.sonarlint.core.plugin.commons.pico.ComponentContainer.execute(ComponentContainer.java:104)
    at org.sonarsource.sonarlint.core.analysis.container.module.ModuleContainer.analyze(ModuleContainer.java:71)
    at org.sonarsource.sonarlint.core.analysis.command.AnalyzeCommand.execute(AnalyzeCommand.java:58)
    at org.sonarsource.sonarlint.core.analysis.command.AnalyzeCommand.execute(AnalyzeCommand.java:32)
    at org.sonarsource.sonarlint.core.analysis.AnalysisEngine$AsyncCommand.execute(AnalysisEngine.java:152)
    at org.sonarsource.sonarlint.core.analysis.AnalysisEngine.executeQueuedCommands(AnalysisEngine.java:70)
    at java.base/java.lang.Thread.run(Thread.java:832)

The verbose log and compile commands are attached at the end of this reply:

maybe it is more convenient to link them here than to paste all file content.

I now have also tried to install jdk 18.0.1.1 and set it manually within the options, with no success.

Hi @Inso,

while generating the compilation database, can you set it to not use response files? Are you able to generate a compilation database with the response files expanded?

1 Like

Sorry for my late reply: no, only I can customize is to add the toolchain paths (which I btw just tried to toggle with no success).

PIO Compile Database Options

Hi @Inso ,

I would better check in Support for SonarLint in Visual Studio Code · Issue #4219 · platformio/platformio-core · GitHub why temporary response files end up in the compilation database. It is not a good practice that temporary response files appear in the compilation database as those files may not be available.