SonarQube "You're not authorized to run analysis" / insufficient privileges in CI
The token was accepted as a valid credential but is not permitted to submit analysis for this project, or it has expired. This is an authorization failure, not a missing token.
What this error means
Analysis fails with "You're not authorized to run analysis. Please contact the project administrator." or "Insufficient privileges", after the token was recognized.
ERROR: You're not authorized to run analysis. Please contact the project administrator.
ERROR: Error during SonarScanner executionCommon causes
The token lacks the Execute Analysis permission
A token can authenticate yet not hold the "Execute Analysis" permission on the project, so the server refuses the upload.
The token expired or was revoked
Analysis tokens can be given an expiry. Once expired or revoked, the server rejects them with an authorization error.
How to fix it
Grant Execute Analysis to the token principal
- In the project or global Permissions, grant "Execute Analysis" to the user or group the token belongs to.
- Or generate a project analysis token that carries the right scope.
- Update the SONAR_TOKEN secret and re-run.
Rotate an expired token
Generate a fresh analysis token in My Account > Security (or project settings), update the SONAR_TOKEN secret, and re-run the workflow.
# after creating a new token, update the secret, then:
gh secret set SONAR_TOKENHow to prevent it
- Use a dedicated analysis token with Execute Analysis permission.
- Track token expiry and rotate before it lapses.
- Keep permissions on a group so token replacement is a one-line change.