Could not find the ref branch to compare from in sonarqube cloud

Hi,
We are currently using sonarqube v10.5.1 using docker image and running builds through Teamcity.
I have two branches and both are successfully pushed to sonarqube, but when I use the reference of branch 1 to another branch, I`m getting the error :

Could not find ref ‘refs/heads/release/r2’ in refs/heads, refs/remotes, refs/remotes/upstream or refs/remotes/origin. You may see unexpected issues and changes. Please make sure to fetch this ref before pull request analysis and refer to the documentation.

Hi,

Welcome to the community!

The message is pretty clear:

Failing to follow this instruction will result in an inaccurate detection of new code.

 
HTH,
Ann