ERROR: You're not authorised to run analysis. Please contact the project administrator

SonarQube server 7.6.0
SonarScanner cli 4.3.0.2102

We have an already working Jenkins pipeline, but suddenly for one branch of a project sonar scanner is throwing

Error during SonarScanner execution
ERROR: You’re not authorized to run analysis. Please contact the project administrator.

Already the branch was running successfully and we made a new commit that updates a code file, after that we are getting this error. The weird thing is that the error is only happening on the Jenkins slave machine ( ubuntu 16.04) and I also manually try build and ran the sonar analysis and got the same error
But I clone the same repo on another ubuntu server (16.04) or my local machine the scan was a success.
One Jenkins I tried to rebuild the previous success commit and that was a success. The only difference between the Jenkins slave machine and the ubuntu machine which I ran the scan is that I preinstalled some required Linux packages.
Also, I created a docker image with a sonar scanner pre-installed, but the result was the same as the above, failed on Jenkins slave and success on other instances.

sonar-scanner -Dsonar.projectKey=**** -Dsonar.sourceEncoding=UTF-8 -Dsonar.branch.name=****** -Dsonar.sources=. -Dsonar.host.url=https://***** -Dsonar.login=**** -Dsonar.java.binaries=********* -Dsonar.verbose=true

Error message

17:53:11.461 INFO: CPD calculation finished
17:53:11.662 INFO: SCM writing changed lines
17:53:11.666 DEBUG: Merge base sha1: 3c3766b3d88791a5c65c219ce544413dd8f7c447
17:53:11.702 DEBUG: Merge base sha1: 3c3766b3d88791a5c65c219ce544413dd8f7c447
17:53:11.710 DEBUG: Merge base sha1: 3c3766b3d88791a5c65c219ce544413dd8f7c447
17:53:11.719 DEBUG: SCM reported changed lines for 3 files in the branch
17:53:11.719 INFO: SCM writing changed lines (done) | time=57ms
17:53:11.746 INFO: Analysis report generated in 258ms, dir size=388 KB
17:53:11.867 INFO: Analysis report compressed in 121ms, zip size=213 KB
17:53:11.867 INFO: Analysis report generated in /home/ubuntu/workspace/DevOps-RD/adhoc/.scannerwork/scanner-report
17:53:11.867 DEBUG: Upload report
17:53:11.877 DEBUG: POST 403 https://sonarqube./api/ce/submit?projectKey=&characteristic=branch%3D***&characteristic=branchType%3DSHORT | time=9ms
17:53:11.953 INFO: ------------------------------------------------------------------------
17:53:11.953 INFO: EXECUTION FAILURE
17:53:11.953 INFO: ------------------------------------------------------------------------
17:53:11.953 INFO: Total time: 20.478s
17:53:12.022 INFO: Final Memory: 27M/97M
17:53:12.022 INFO: ------------------------------------------------------------------------
17:53:12.022 ERROR: Error during SonarScanner execution
17:53:12.022 ERROR: You’re not authorized to run analysis. Please contact the project administrator.
17:53:12.022 ERROR:
17:53:12.022 ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

Can someone please help me with this issue?
NB: All other projects and branches are working fine

Hi,

Welcome to the community!

You say this is a sudden change for a single project. I take that to mean the pipeline was previously successfully analyzing this project?

If that’s the case, I’m going to guess someone edited the project configuration to either newly require credentials for analysis or to remove permissions from the user whose credentials you were using.

In either case, the answer is to generate an analysis token from a user account that has permissions and pass it as you sonar.login value.

 
HTH,
Ann

Yes it was a sudden change. I tested the same token and run the sonar scan on another ubuntu server and able to complete successfully.
Any idea how the server affect the sonar-scanner cli?

Hi,

Sorry, but I have no idea what’s going on here. As you say, it’s environment-specific, so I’d concentrate on what’s different (what’s gone wrong?) in that environment.

 
Ann

The wired thing is why it showing authentication failure instead of proper error message? Let me concentrate on whats gone wrong on the server

A post was split to a new topic: Analysis fails with permissions error

Were you able to figure the issue? Facing similar issue!