Multiple projects started failing with "Could not find a default branch for project with key"

We started seeing multiple projects in our org failing with error ERROR Could not find a default branch for project with key '<ORG>_<PROJECT>'. Make sure project exists.. The projects were fine a few days ago but since two days ago (2025-03-12) we are seeing the following error. It persists over multiple runs in multiple projects.

We are using GitHub for Code hosting and GitHub Runners for CI. We use SonarSource/sonarqube-scan-action@master to trigger Sonar.

We have a lot of projects, so a suggestion like rotating the API Token is not a suitable solution for us.

Full log of a run is attached (I replaced the org and repo name with and respectively).

08:21:04.291 INFO  Project root configuration file: /home/runner/work/<PROJECT>/<PROJECT>/sonar-project.properties
08:21:04.314 INFO  SonarScanner CLI 7.0.2.4839
08:21:04.317 INFO  Java 17.0.13 Eclipse Adoptium (64-bit)
08:21:04.318 INFO  Linux 6.8.0-1021-azure amd64
08:21:04.349 INFO  User cache: /home/runner/.sonar/cache
08:21:05.299 INFO  JRE provisioning: os[linux], arch[x86_64]
08:21:09.224 INFO  Communicating with SonarQube Cloud
08:21:09.796 INFO  Starting SonarScanner Engine...
08:21:09.801 INFO  Java 17.0.11 Eclipse Adoptium (64-bit)
08:21:11.067 INFO  Load global settings
08:21:11.672 INFO  Load global settings (done) | time=603ms
08:21:11.674 INFO  Server id: 1BD809FA-AWHW8ct9-T_TB3XqouNu
08:21:11.911 INFO  Loading required plugins
08:21:11.912 INFO  Load plugins index
08:21:12.072 INFO  Load plugins index (done) | time=157ms
08:21:12.072 INFO  Load/download plugins
08:21:13.097 INFO  Load/download plugins (done) | time=1029ms
08:21:13.533 INFO  Found an active CI vendor: 'Github Actions'
08:21:13.550 INFO  Load project settings for component key: '<ORG>_<PROJECT>'
08:21:13.732 INFO  Process project properties
08:21:13.741 INFO  Project key: <ORG>_<PROJECT>
08:21:13.743 INFO  Base dir: /home/runner/work/<PROJECT>/<PROJECT>
08:21:13.746 INFO  Working dir: /home/runner/work/<PROJECT>/<PROJECT>/.scannerwork
08:21:13.748 INFO  Load project branches
08:21:13.886 INFO  Load project branches (done) | time=139ms
08:21:13.890 INFO  Check ALM binding of project '<ORG>_<PROJECT>'
08:21:14.038 INFO  Detected project binding: NONEXISTENT
08:21:14.038 INFO  Check ALM binding of project '<ORG>_<PROJECT>' (done) | time=149ms
08:21:14.041 INFO  Load project pull requests
08:21:14.189 INFO  Load project pull requests (done) | time=147ms
08:21:14.194 INFO  Load branch configuration
08:21:14.196 INFO  Github event: push
08:21:14.204 INFO  Auto-configuring branch main
08:21:14.209 ERROR Could not find a default branch for project with key '<ORG>_<PROJECT>'. Make sure project exists.

Well, if the token has been revoked (or it belongs to a user who is no longer in the organization), I don’t think you’ll have much choice other than to rotate it!

I suggest you first verify this is a token problem by selecting one project, facing this issue, generating a new token for a user that you’re sure has Execute Analysis permissions for the project and replacing it for a project’s pipeline.

On that note, if you don’t think the token has been revoked, and the user who generated it is still at your organization – make sure that user still has the expected at the project or org level (Execute Analysis)_