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

hi Shane. Apparently I can’t tag you lol. sorry for the late reply. I do appreciate you getting back.

The last failure was:

May 15, 2024 - 11:24:12 AM

Started/Ended: 11:24:12 AM

We’re using a sonar_token in GitHub actions so I believe all of that information gets injected, because I don’t see it on the build.yml. the only thing we put there are custom settings for the coverage/exclusions/etc. I do see on the task that failed, it shows you everything, so if you can access that and let us know what’s going on. that would be great

This is what the task is:
iOSToolbox Project Analysis

ID: AY982plhk64-NvkBkgsL

can you view that and access everything? the project key is correct. It’s just strange because this error only occurs when a PR is merged onto the main branch. when we create PRs and make revisions, the sonar scan works correctly.

Hi @pqsk

Thanks for getting back to us.
We opened an internal ticket for this issue and will get back to you with more information when we have some.

Thanks so much Claire. We’ll be standing by.

Hi Claire, is there an update or timeline on when we should get some sort of resolution? Thanks

Hi @pqsk

Due to some conflicting priorities and roadmap, this has not been prioritized yet.

Understood. Thanks for the update Claire.

Hi @pqsk

We are struggling to reproduce the behavior. To get some additional data, I’ll start a private thread with you and a colleague who joined me in the effort.

Thanks in advance for your patience,
Claire

Thanks again @pqsk for your help.
It led us to identify a workaround. For anyone stumbling into this thread with a similar problem, please visit this other thread: Last analysis failed Analysis ID "AY3RMLzw_uwY6bmnCUzO" - #10 by eric.giffon

1 Like