Issues with sonar-scanner and paths with @

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

  • how is SonarQube deployed: zip, Docker, Helm
    We run the scanner from Jenkins in a Docker image on a node project.

  • what are you trying to achieve
    Scan the code

  • what have you tried so far to achieve this

Everything works as expected as long as the workspace path doesn’t contain an @. But when Jenkins gets a name collision (e.g. two parallell jobs on the same node) it defaults to adding @2 (and then @3 etc.) to the end of the workspace path. When that happens SonarQube fails to launch with this error (local paths replaced):

17:00:04  node:internal/errors:563
17:00:04      ErrorCaptureStackTrace(err);
17:00:04      ^
17:00:04  <ref *1> Error: spawnSync /<workspacepath>/jobname\@2/node_modules/.bin/.sonar/native-sonar-scanner/sonar-scanner- ENOENT
17:00:04      at Object.spawnSync (node:internal/child_process:1124:20)
17:00:04      at spawnSync (node:child_process:876:24)
17:00:04      at execFileSync (node:child_process:919:15)
17:00:04      at scan (/<workspacepath>/jobname@2/node_modules/sonarqube-scanner/src/index.js:40:3)
17:00:04      at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
17:00:04    errno: -2,
17:00:04    code: 'ENOENT',
17:00:04    syscall: 'spawnSync /<workspacepath>/jobname\\@2/node_modules/.bin/.sonar/native-sonar-scanner/sonar-scanner-',
17:00:04    path: '/<workspacepath>/jobname\\@2/node_modules/.bin/.sonar/native-sonar-scanner/sonar-scanner-',
17:00:04    spawnargs: [ '--from=ScannerNpm/3.3.0' ],
17:00:04    error: [Circular *1],
17:00:04    status: null,
17:00:04    signal: null,
17:00:04    output: null,
17:00:04    pid: 0,
17:00:04    stdout: null,
17:00:04    stderr: null
17:00:04  }

Hello @fassen,

From the logs, it seems that you rely on the sonar-scanner-npm. We just released a new version (3.5.0) with some fixes. Can you please try again with the new version and let us know if the issue persists?


Yes, we’re using sonar-scanner-npm (I should probably have been clearer about that). Anyway, 3.5.0 seems to fix the issue.


1 Like