Reference branch set with 'sonar.newCode.referenceBranch' points to the current branch

Hi, we configured many of our sonarqube projects to have “dev” as the default branch, everything worked fine until about 3 weeks ago, when suddenly, without any changes in the sonarqube or jenkins configurations, we started seeing dozens of Jenkins jobs fail with error:

java.lang.IllegalStateException: Reference branch set with ‘sonar.newCode.referenceBranch’ points to the current branch ‘dev’

we was trying to deploy&analyze the dev branch.

These are the sonar properties in the example jenkins project:

sonar.projectKey=$JOB_BASE_NAME <- dev
sonar.projectName=$JOB_NAME
sonar.branch.name=$WASTE_BRANCH <- dev
sonar.sources=.
sonar.token=$sonar_token

How can we fix this error?

SQ v10.3.0 deployed by docker image 10.3.0-developer

Hey there.

Is it possible that sonar.newCode.referenceBranch got set by somebody in your global SonarQube server configuration on Jenkins (where you specify the SonarQube URL)?

Hi Colin,
unfortunately this is not the case, I checked and there are no custom parameters in the configuration.
Can I check something else?
Thanks a lot for the help.

Thanks. Can you show me how the project-level Administration > New Code of your project is defined? A screenshot would be great.

Hi @Colin, here it is:

all projects default to system settings

That’s the global level – how about one of the individual affected projects?

project-level Administration > New Code

Hi @Colin, this is the project level conf:

and this is the error of tonight’s build:

Thanks for the help

Thanks. I’m flagging this for experts since I’ve run out of ideas.

Thanks @Colin, please let me know if there are any updates