Project or branch in report does not match the project or branch under which it was submitted

Template for a good new topic, formatted with Markdown:

  • ALM used: GitHub
  • CI system used: GitHub
  • Scanner command used when applicable (private details masked): N/A
  • Languages of the repository: Swift
  • Only if the SonarCloud project is public, the URL: private
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting): see below
  • Steps to reproduce: Merge PR to main branch
  • Potential workaround: N/A

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

We’re getting this error:
Project or branch in report (projectKey) does not match the project or branch under which it was submitted (projectKey:BRANCH:mainBranch)

projectKey and mainBranch are NOT the real values. This only happens when merging a PR to the main branch. When a PR is created, the scan is done correctly. The only change is that the main branch was changed from a different branch some months ago. What makes it difficult to understand is that the sonar scan wasn’t setup properly before, so when it was configured properly is when the main branch was changed.

What other information do I need to share? Or is there anything that anyone knows that could cause this and we can fix in some configuration? Appreciate any help.

Hi @pqsk,

Are you using a sonar-project.properties file to detail your project key and other settings? Would you be able to share this if you are? Alternatively are you passing the values manually. If you can share some information of the parameters you are passing this would help to isolate the issue. Also if you have a recent date and time of a failure I could try and find this in our logs to further assess the issue.

Thanks,
Shane