Sonar-scanner-cli in GitLab suddenly stopped working

Dear commnity,
I would really appreciate any advice about the following error:

  • ALM used : gitlab.com

  • CI system used: GitLab Pipelines

  • Scanner command used : sonar-scanner
    (with docker image sonarsource/sonar-scanner-cli:12)

  • Languages of the repository : Typescript

  • Only if the SonarCloud project is public, the URL

  • Error observed :
    Yesterday (06/01/2026), everything was working fine.
    Today, the analysis cannot be done any more with the following error:
    ERROR Project not found. Please check the 'sonar.projectKey' and 'sonar.organization' properties, the 'SONAR_TOKEN' environment variable, or contact the project administrator to check the permissions of the user the token belongs to

    Nothing has changed.
    I’ve tried to recreate the token, verified the configuration (project name, etc…), and tried with another version of sonarsource/sonar-scanner-cli, but it just doesn’t work any more.

    The whole project is open-source and the complete sonar-log can be seen here : sonarcloud-check (#12635436840) · Jobs · GeoGirafe / GeoGirafe Viewer · GitLab

Thanks !

Hi,

Welcome to the community and thanks for providing the log right off! :sweat_smile:

Looking at your list of jobs, this seems to be succeeding for branches and failing for PRs.

Digging into the log you pointed to, from this part, your project is recognized and found on SonarQube Cloud

I believe once we get to here, there is communication with the DevOps platform about the project/PR

Is there anything about analysis that would run differently with a PR versus your main branch?

 
Thx,
Ann

Hi Ann,

Thanks a lot for your response.

Actually I noticed today what you just explained : the sonar scan just does not work for merge-request. But it still works for the main branch.

I’ve also noticed that Gitlab.com got an update yesterday : GitLab Patch Release: 18.7.1, 18.6.3, 18.5.5 | GitLab

I suppose this is actually a gitlab problem, not a sonar one :slight_smile:

I will try to identify if some gitlan change has broken the sonar scan, and evtl. open an issue on gitlab directly if I cannot find anything.

I’ll come back with more infos if I have some, thanks !

1 Like

Hi Ann,

I could finally fix it… It was the GitLab token that expired.

I could get the right error while activating the debug output of sonar with `sonar-scaner -X`.

I just cannot understand why the analysis was still working on a branch, but not on a merge-request, this is nonsense. But replacing the gitlab token with a new one in the sonar configuration solved my issue, and my analysis is now working again.

As it as not very intuitive to find where I can replace the gitlab token in the sonar frontend, I share the info here:

  1. Generate a new token in gitlab with the “api” scope
  2. Got to MyProject > Administration > Organization-settings > Organization binding.
  3. At the bottom, a message show that the token is invalid. You can update it here.

Thanks and have a nice day,
Guillaume.

2 Likes