Skip to content
Latchkey

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.

sonar-scanner
ERROR: You're not authorized to run analysis. Please contact the project administrator.
ERROR: Error during SonarScanner execution

Common 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

  1. In the project or global Permissions, grant "Execute Analysis" to the user or group the token belongs to.
  2. Or generate a project analysis token that carries the right scope.
  3. 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.

Terminal
# after creating a new token, update the secret, then:
gh secret set SONAR_TOKEN

How 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.

Frequently asked questions

What causes ""You're not authorized to run analysis""?
A token can authenticate yet not hold the "Execute Analysis" permission on the project, so the server refuses the upload.
How do I fix "You're not authorized to run analysis"?
Grant Execute Analysis to the token principal

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card