SonarScanner CLI error: unexpanded response file

Hi, I try to add my SonarScanner to my our repository, which is a mix of swift and Objective C++ code. My company uses SonarScanner CLI 6.2.1.4610 and SonarQube Server 9.9.0.65466. Pipeline steps SonarQubePrepare, SonarQube Compilation Database passes. The isssue happens when performing SonarQubeAnalyze. I’ve looked at compile_commands.json and the json is valid.

Console output from Azure

##[section]Starting: SonarQubeAnalyze
==============================================================================
Task         : Run Code Analysis
Description  : Run scanner and upload the results to the SonarQube Server.
Version      : 7.1.1
Author       : sonarsource
Help         : This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.

[More Information](https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/scanners/sonarqube-extension-for-azure-devops/)
==============================================================================
[command]/Users/username/myagent/_work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/7.1.1/sonar-scanner/bin/sonar-scanner
12:22:39.251 INFO  Scanner configuration file: /Users/username/myagent/_work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/7.1.1/sonar-scanner/conf/sonar-scanner.properties
12:22:39.254 INFO  Project root configuration file: /Users/svc_gdn_devops_002/myagent/_work/36/s/sonar-project.properties
12:22:39.262 INFO  SonarScanner CLI 6.2.1.4610
12:22:39.263 INFO  Java 17.0.2 Oracle Corporation (64-bit)
12:22:39.263 INFO  Mac OS X 15.2 aarch64
12:22:39.284 INFO  User cache: /Users/svc_gdn_devops_002/.sonar/cache
12:22:41.767 INFO  Communicating with SonarQube Server 9.9.0.65466
12:22:41.958 INFO  Load global settings
12:22:42.982 INFO  Load global settings (done) | time=1023ms
12:22:42.983 INFO  Server id: FF13C567-AWJ4Eq3QFHsNv5BZUpr7
12:22:42.984 INFO  User cache: /Users/svc_gdn_devops_002/.sonar/cache
12:22:42.986 INFO  Load/download plugins
12:22:42.986 INFO  Load plugins index
12:22:43.209 INFO  Load plugins index (done) | time=223ms
12:22:43.351 INFO  Load/download plugins (done) | time=365ms
12:22:43.457 INFO  Loaded core extensions: developer-scanner
12:22:43.699 INFO  Process project properties
12:22:43.705 INFO  Process project properties (done) | time=6ms
12:22:43.706 INFO  Execute project builders
12:22:43.707 INFO  Execute project builders (done) | time=1ms
12:22:43.708 INFO  Project key: xxx-iPad
12:22:43.708 INFO  Base dir: /Users/svc_gdn_devops_002/myagent/_work/36/s
12:22:43.708 INFO  Working dir: /Users/svc_gdn_devops_002/myagent/_work/36/s/.scannerwork
12:22:43.711 INFO  Load project settings for component key: 'xxx-iPad'
12:22:43.931 INFO  Load project settings for component key: 'xxx-iPad' (done) | time=220ms
12:22:43.991 INFO  Load project branches
12:22:44.194 INFO  Load project branches (done) | time=203ms
12:22:44.194 INFO  Load branch configuration
12:22:44.195 INFO  Load branch configuration (done) | time=1ms
12:22:44.229 INFO  Auto-configuring with CI 'Azure DevOps'
12:22:44.230 INFO  Load quality profiles
12:22:44.479 INFO  Load quality profiles (done) | time=249ms
12:22:44.483 INFO  Load active rules
12:22:53.237 INFO  Load active rules (done) | time=8754ms
12:22:53.239 INFO  Load analysis cache
12:22:53.428 INFO  Load analysis cache (404) | time=189ms
12:22:53.466 INFO  Load project repositories
12:22:53.748 INFO  Load project repositories (done) | time=282ms
12:22:53.765 INFO  Indexing files...
12:22:53.765 INFO  Project configuration:
12:22:53.765 INFO    Excluded sources: xxxx
12:22:54.362 INFO  861 files indexed
12:22:54.362 INFO  2337 files ignored because of inclusion/exclusion patterns
12:22:54.362 INFO  2 files ignored because of scm ignore settings
12:22:54.362 INFO  Quality profile for c: Sonar way
12:22:54.362 INFO  Quality profile for cpp: Sonar way
12:22:54.362 INFO  Quality profile for json: Sonar way
12:22:54.362 INFO  Quality profile for objc: Sonar way
12:22:54.363 INFO  Quality profile for swift: Sonar way
12:22:54.363 INFO  Quality profile for yaml: Sonar way
12:22:54.363 INFO  ------------- Run sensors on module xxx-iPad
12:22:54.458 INFO  Load metrics repository
12:22:54.656 INFO  Load metrics repository (done) | time=198ms
12:22:55.622 INFO  Sensor IaC CloudFormation Sensor [iac]
12:22:55.649 INFO  0 source files to be analyzed
12:22:55.660 INFO  0/0 source files have been analyzed
12:22:55.661 INFO  Sensor IaC CloudFormation Sensor [iac] (done) | time=38ms
12:22:55.661 INFO  Sensor IaC Kubernetes Sensor [iac]
12:22:55.667 INFO  0 source files to be analyzed
12:22:55.670 INFO  0/0 source files have been analyzed
12:22:55.670 INFO  Sensor IaC Kubernetes Sensor [iac] (done) | time=9ms
12:22:55.670 INFO  Sensor C# Project Type Information [csharp]
12:22:55.671 INFO  Sensor C# Project Type Information [csharp] (done) | time=1ms
12:22:55.671 INFO  Sensor C# Analysis Log [csharp]
12:22:55.677 INFO  Sensor C# Analysis Log [csharp] (done) | time=6ms
12:22:55.677 INFO  Sensor C# Properties [csharp]
12:22:55.677 INFO  Sensor C# Properties [csharp] (done) | time=0ms
12:22:55.677 INFO  Sensor HTML [web]
12:22:55.679 INFO  Sensor HTML [web] (done) | time=2ms
12:22:55.679 INFO  Sensor TextAndSecretsSensor [text]
12:22:55.684 INFO  757 source files to be analyzed
12:22:55.748 WARN  Invalid character encountered in file /xxx/xxx.cfg at line 22 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
12:22:55.813 WARN  Invalid character encountered in file /xxx/xxx.BDB at line 1 for encoding windows-1252. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
12:22:55.877 WARN  'bdb' was added to the binary file filter because the file 'xxx/xxx' is a binary file.
12:22:55.877 INFO  To remove the previous warning you can add the '.bdb' extension to the 'sonar.text.excluded.file.suffixes' property.
12:22:55.878 WARN  Invalid character encountered in file /xxx/xxx.sdb at line 1 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
12:22:55.881 WARN  'sdb' was added to the binary file filter because the file 'xxx/xxx.sdb' is a binary file.
12:22:56.638 INFO  757/757 source files have been analyzed
12:22:56.638 INFO  Sensor TextAndSecretsSensor [text] (done) | time=959ms
12:22:56.638 INFO  Sensor VB.NET Project Type Information [vbnet]
12:22:56.639 INFO  Sensor VB.NET Project Type Information [vbnet] (done) | time=1ms
12:22:56.639 INFO  Sensor VB.NET Analysis Log [vbnet]
12:22:56.654 INFO  Sensor VB.NET Analysis Log [vbnet] (done) | time=15ms
12:22:56.654 INFO  Sensor VB.NET Properties [vbnet]
12:22:56.654 INFO  Sensor VB.NET Properties [vbnet] (done) | time=0ms
12:22:56.654 INFO  Sensor Swift Code Quality and Security [swift]
12:22:56.655 INFO  340 source files to be analyzed
12:23:01.487 INFO  340/340 source files have been analyzed
12:23:01.487 INFO  Sensor Swift Code Quality and Security [swift] (done) | time=4833ms
12:23:01.487 INFO  Sensor JaCoCo XML Report Importer [jacoco]
12:23:01.487 INFO  'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
12:23:01.488 INFO  No report imported, no coverage information will be imported by JaCoCo XML Report Importer
12:23:01.488 INFO  Sensor JaCoCo XML Report Importer [jacoco] (done) | time=1ms
12:23:01.488 INFO  Sensor JavaScript inside YAML analysis [javascript]
12:23:01.489 INFO  No input files found for analysis
12:23:01.489 INFO  Hit the cache for 0 out of 0
12:23:01.489 INFO  Miss the cache for 0 out of 0
12:23:01.490 INFO  Sensor JavaScript inside YAML analysis [javascript] (done) | time=2ms
12:23:01.490 INFO  Sensor CSS Rules [javascript]
12:23:01.490 INFO  No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
12:23:01.490 INFO  Sensor CSS Rules [javascript] (done) | time=0ms
12:23:01.490 INFO  Sensor ThymeLeaf template sensor [securityjavafrontend]
12:23:01.491 INFO  Sensor ThymeLeaf template sensor [securityjavafrontend] (done) | time=1ms
12:23:01.491 INFO  Sensor IaC Docker Sensor [iac]
12:23:01.493 INFO  0 source files to be analyzed
12:23:01.514 INFO  0/0 source files have been analyzed
12:23:01.514 INFO  Sensor IaC Docker Sensor [iac] (done) | time=23ms
12:23:01.514 INFO  Sensor Serverless configuration file sensor [security]
12:23:01.515 INFO  0 Serverless function entries were found in the project
12:23:01.517 INFO  0 Serverless function handlers were kept as entrypoints
12:23:01.517 INFO  Sensor Serverless configuration file sensor [security] (done) | time=3ms
12:23:01.517 INFO  Sensor AWS SAM template file sensor [security]
12:23:01.518 INFO  Sensor AWS SAM template file sensor [security] (done) | time=1ms
12:23:01.518 INFO  Sensor AWS SAM Inline template file sensor [security]
12:23:01.518 INFO  Sensor AWS SAM Inline template file sensor [security] (done) | time=0ms
12:23:01.518 INFO  Sensor CFamily [cpp]
12:23:01.533 INFO  CFamily plugin version: 6.41.0.60884
12:23:01.533 INFO  Using compile commands: /Users/svc_gdn_devops_002/myagent/_work/36/s/compile_commands.json
12:23:01.534 INFO  Available processors: 8
12:23:01.534 INFO  Using 8 threads for analysis.
12:23:03.068 INFO  Found empty cache on server
12:23:03.176 INFO  EXECUTION FAILURE
12:23:03.176 INFO  Total time: 23.943s
##[error]12:23:03.176 ERROR Error during SonarScanner CLI execution
java.lang.IllegalStateException: unexpanded response file
	at com.sonar.cpp.analyzer.ClangDriver.onCapture(ClangDriver.java:429)
	at com.sonar.cpp.analyzer.CompilerDrivers.onCapture(CompilerDrivers.java:34)
	at com.sonar.cpp.plugin.CFamilySensor.lambda$process$17(CFamilySensor.java:908)
	at com.sonar.cpp.plugin.CompileCommandsReader.readCaptures(CompileCommandsReader.java:60)
	at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:905)
	at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:410)
	at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:215)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:64)
	at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:82)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
	at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:403)
	at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:399)
	at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:368)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
	at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:137)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
	at org.sonarsource.scanner.lib.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:41)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.sonarsource.scanner.lib.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:62)
	at jdk.proxy3/jdk.proxy3.$Proxy2.execute(Unknown Source)
	at org.sonarsource.scanner.lib.InProcessScannerEngineFacade.doAnalyze(InProcessScannerEngineFacade.java:39)
	at org.sonarsource.scanner.lib.ScannerEngineFacade.analyze(ScannerEngineFacade.java:61)
	at org.sonarsource.scanner.cli.Main.analyze(Main.java:77)
	at org.sonarsource.scanner.cli.Main.main(Main.java:63)
12:23:03.176 ERROR Error during SonarScanner CLI execution
java.lang.IllegalStateException: unexpanded response file
	at com.sonar.cpp.analyzer.ClangDriver.onCapture(ClangDriver.java:429)
	at com.sonar.cpp.analyzer.CompilerDrivers.onCapture(CompilerDrivers.java:34)
	at com.sonar.cpp.plugin.CFamilySensor.lambda$process$17(CFamilySensor.java:908)
	at com.sonar.cpp.plugin.CompileCommandsReader.readCaptures(CompileCommandsReader.java:60)
	at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:905)
	at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:410)
	at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:215)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:64)
	at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:82)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
	at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:403)
	at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:399)
	at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:368)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
	at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:137)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
	at org.sonarsource.scanner.lib.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:41)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.sonarsource.scanner.lib.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:62)
	at jdk.proxy3/jdk.proxy3.$Proxy2.execute(Unknown Source)
	at org.sonarsource.scanner.lib.InProcessScannerEngineFacade.doAnalyze(InProcessScannerEngineFacade.java:39)
	at org.sonarsource.scanner.lib.ScannerEngineFacade.analyze(ScannerEngineFacade.java:61)
	at org.sonarsource.scanner.cli.Main.analyze(Main.java:77)
	at org.sonarsource.scanner.cli.Main.main(Main.java:63)
##[error]12:23:03.177 ERROR 
12:23:03.177 ERROR Re-run SonarScanner CLI using the -X switch to enable full debug logging.
12:23:03.177 ERROR 
12:23:03.177 ERROR Re-run SonarScanner CLI using the -X switch to enable full debug logging.
##[error][ERROR] SonarQube Server: Error while executing task Analyze: The process '/Users/username/myagent/_work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/7.1.1/sonar-scanner/bin/sonar-scanner' failed with exit code 1
##[error]The process '/Users/username/myagent/_work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/7.1.1/sonar-scanner/bin/sonar-scanner' failed with exit code 1
##[section]Finishing: SonarQubeAnalyze

yml pipeline fragment


  - task: SonarQubePrepare@6
    inputs:
      SonarQube: 'SonarQube-EEC'
      scannerMode: 'CLI'
      configMode: 'file'
      configFile: ${{ parameters.configFile }}
      extraProperties: |
        sonar.projectVersion=$(Build.BuildNumber)

  - ${{ if eq(parameters.cfamilyUseBuildWrapper, true) }}:
    - script: |
        $(Build.SourcesDirectory)/build-wrapper-macosx-x86/build-wrapper-macosx-x86 --out-dir sonar-bw-output xcodebuild -project ${{ parameters.cfamilyWrapperProject }} -scheme ${{ parameters.cfamilyWrapperScheme }} clean build
      displayName: 'SonarQube build-wrapper'
      env:
        DEVELOPER_DIR: /Applications/Xcode-${{ parameters.xcodeVersion }}.app/Contents/Developer
      continueOnError: true
  - ${{ else }}:
    - script: |
        xcodebuild -project ${{ parameters.cfamilyWrapperProject }} -scheme ${{ parameters.cfamilyWrapperScheme }} ${{ parameters.cfamilyWrapperExtraBuildParams }} clean build | xcpretty -r json-compilation-database --output compile_commands.json
      displayName: 'SonarQube Compilation Database'
      env:
        DEVELOPER_DIR: /Applications/Xcode-${{ parameters.xcodeVersion }}.app/Contents/Developer
      continueOnError: true

  - task: SonarQubeAnalyze@6
    continueOnError: true
    
  - task: SonarQubePublish@6
    inputs:
      pollingTimeoutSec: '1000'

Hi,

Welcome to the community!

Your version is past EOL. You should upgrade to either the latest version or the current LTA (long-term active version) at your earliest convenience. Your upgrade path is:

9.9.0 → 2025.1

You may find these resources helpful:

If you have questions about upgrading, feel free to open a new thread for that here.

Once you’ve upgraded, you should find that this has been fixed.

 
HTH,
Ann

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