Can not add the same measure twice on blue-deployment.yml

I have a CI/CD for a java project where I call sonarqube and analysis goes through successfuly until this morning. I added a yaml file in the project, very simple yaml, for the creation of pod in K8S, as soon as I ran the cicd pipeline I got

ERROR: Error during SonarScanner execution
java.lang.UnsupportedOperationException: Can not add the same measure twice on blue-deployment.yml: DefaultMeasure[component=blue-deployment.yml,metric=Metric[uuid=<null>,key=ncloc_data,description=<null>,type=DATA,direction=0,domain=<null>,name=ncloc_data,qualitative=false,userManaged=false,enabled=true,worstValue=<null>,bestValue=<null>,optimizedBestValue=false,hidden=false,deleteHistoricalData=false,decimalScale=<null>],value=1=1;2=1;3=1;4=1;5=1;6=1;7=1;8=1;9=1;10=1;11=1;12=1;13=1;14=1;15=1;16=1;17=1;18=1;19=1;20=1;21=1;22=1,fromCore=false,storage=org.sonar.scanner.sensor.DefaultSensorStorage@300b839c,saved=false]
	at org.sonar.scanner.sensor.DefaultSensorStorage.saveMeasure(
	at org.sonar.api.batch.sensor.measure.internal.DefaultMeasure.doSave(

Must-share information (formatted with Markdown):

  • versions SonarQube : 9.8
  • how is SonarQube deployed: on a fedora 37 VM

The call to sonarQube happens inside a jenkins pipeline as follows

stage('SonarQube Analysis') {
            steps {
                sh 'sonar-scanner \
                -Dsonar.login=sqa_8f0.................6f88888ba \
                -Dsonar.projectKey=game-of-lifeonGitHub \
                -Dsonar.sources=. \


This error typically comes from an overlap in the definition of sonar.sources and sonar.tests. Can you check Project Settings → Background Tasks → [row cog menu] → Show Scanner Context and see if sonar.tests is defined (perhaps in a file)? A definition of sonar.sources=. is pretty broad and would automatically overlap anything defined for sonar.tests.


Hi Ann, I did visit the project settings, no sonar.tests item (I have disabled K8S plugin in the system to be able to run the analysis)

Scanner Context: game-of-lifeonGitHub [Project Analysis]
  - Dependency-Check 3.0.1 (dependencycheck)
  - jDepend 1.1.1 (jdepend)
  - detekt 2.5.0 (detekt)
  - Sonar WebDriver Plugin 1.0.5 (webdriver)
  - YAML Analyzer 1.7.0 (yaml)
Bundled analyzers:
  - Python Code Quality and Security (python)
  - Go Code Quality and Security (go)
  - JaCoCo (jacoco)
  - Kotlin Code Quality and Security (kotlin)
  - IaC Code Quality and Security (iac)
  - JavaScript/TypeScript/CSS Code Quality and Security (javascript)
  - Ruby Code Quality and Security (ruby)
  - Scala Code Quality and Security (sonarscala)
  - C# Code Quality and Security (csharp)
  - Java Code Quality and Security (java)
  - HTML Code Quality and Security (web)
  - Flex Code Quality and Security (flex)
  - XML Code Quality and Security (xml)
  - PHP Code Quality and Security (php)
  - Text file Code Quality and Security (text)
  - VB.NET Code Quality and Security (vbnet)
  - Configuration detection fot Code Quality and Security (config)
Global server settings:
  - sonar.core.startTime=2023-04-20T09:14:06+0200
  - sonar.forceAuthentication=false
  - sonar.kubernetes.activate=false
  - sonar.lf.enableGravatar=true
  - sonar.plugins.risk.consent=ACCEPTED
  - sonar.projectCreation.mainBranchName=master
Project server settings:
Project scanner properties:
  - sonar.login=******
  - sonar.projectBaseDir=/home/jenkins/workspace/blue-green-deployment
  - sonar.projectKey=game-of-lifeonGitHub
  - sonar.scanner.appVersion=
  - sonar.sourceEncoding=UTF-8
  - sonar.sources=.


Thanks for including the full context!

Can you uninstall the YAML plugin & try again? I’m guessing that’s where the conflict is coming from.


Thanks Ann, I uninstalled the yaml, renabled K8S and analysis went through but in spite of the fact that I have 3 yaml K8S files I dont see any activity of analysis on those files? Where can we see what happened during analysis, what I mean what SQ analyzed?
Thanks again for your help


Ah! Right. You’re on SonarQube 9.8. Upgrade to 9.9 (since you have to hit each intervening LTS version between your start point and your target version) and then to 10.0 and try again, please.