SonarCloud - The syntax of the command is incorrect

Hello,

I’ve configured new SC subscription and try to run CI pipeline with SC tasks on on-prem agent where previously SC was working. I’m using correct service connection for this subscription.

Executing file D:\Build\[agent_name]\_work\_tasks\SonarCloudPrepare_14d9cde6-c1da-4d55-aa01-2965cd301255\1.21.0\classic-sonar-scanner-msbuild\sonar-scanner-4.6.2.2472\bin\sonar-scanner.bat
  Args: -Dsonar.scanAllFiles=true -Dproject.settings=D:\Build\[agent_name]\_work\9\.sonarqube\out\sonar-project.properties --from=ScannerMSBuild/5.3.1 --debug <sensitive data removed>

I’m getting error:
##[error]The syntax of the command is incorrect. (I'm unable to add attachment)

When I try to run the command on the machine through command line without --debug parameter, it fails with different error:

ERROR: You're not authorized to run analysis. No sonar.login or SONAR_TOKEN env
variable was set

That makes sense, since I’m running it outside of pipeline.

Workarounds attempted:

  • Cleaned all agent’s _task data
  • Configured new agent that in its path doesn’t have spaces, ran the pipeline on it without success

Any suggestion what I’m doing wrong?

Summary:

  • ALM used - Azure DevOps
  • CI system used - Azure DevOps
  • Scanner command used when applicable (private details masked)
  • Languages of the repository - .NET

Hi @Danielson

Can you show us how you configured the SC task please ? (i mean, with a screenshot or plain text copy of the task if it’s in YAML, with relevant things redacted)

Thanks.

Hi @mickaelcaro

I’ve restarted the whole build server and it started to work… :slight_smile:

Thank you

1 Like

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