SonarQube — Quality Gates, Web API, Administration, Errors and Mistakes

How SonarQube Server computes quality gates, how to read them through the Web API, and how to run the server. Covers the production errors, the mistakes that fake a green gate, and how to investigate a bug static analysis missed.

Overview

SonarQube Server is usually trusted as a yes or no answer: the quality gate passed, so the code may ship. In production the failures are rarely in that answer itself. They are in what fed it: a scanner that analyzed the wrong branch, a background task that failed so the dashboard still shows yesterday, a coverage report that was never found, a new code definition that hides the change, an issue someone marked Accepted to get a release out, or an exclusion pattern that removed the file that later broke.

This page covers how the gate is computed, how to read it from the Web API, how to run the server (Compute Engine, Elasticsearch, database, upgrades, tokens, webhooks), the errors you will see, and the mistakes that turn a green gate into a false promise.

Both the version and the edition change what you can do. Up to 10.8 SonarQube Server used MAJOR.MINOR.PATCH; since then it uses YYYY.ReleaseNumber.PatchReleaseNumber, with a release every two months and two Long-Term Active (LTA) releases a year. The current documentation describes 2026.5 LTA (the previous LTA is 2026.1), and the Web API reference on next.sonarqube.com runs a 2026.6 build. Editions matter too: branch analysis, pull request analysis and pull request decoration need Developer Edition or higher; SonarQube Community Build does not have them.

> [!IMPORTANT] A green quality gate means the conditions you configured passed on the code that was analyzed, for the code SonarQube counted as new. Every one of those three clauses can be wrong without the gate turning red.

From commit to quality gate status

The gate is computed on the server after the Compute Engine finishes the background task, not when the scanner exits. The path from a commit to a status has six steps.

  • CI checks out the code, ideally as a full-depth clone.
  • The SonarScanner runs the language analyzers with the project's quality profile.
  • The scanner uploads its report, and a background task is queued.
  • The Compute Engine processes reports in order and writes the results to the database and Elasticsearch.
  • The Compute Engine computes the quality gate status, OK or ERROR.
  • Webhooks, pull request decoration and api/qualitygates/project_status report that status.

Two of those steps are where a wrong answer usually enters. At step 2 the scanner analyzes the wrong branch, works from a shallow clone or misses the coverage report. At step 4 the task FAILED or is still PENDING, so the old results are shown.

Key concepts

  • Quality gate
  • Sonar way gate
  • New code definition
  • Issue backdating
  • Background task
  • project_status NONE
  • Fudge factor
  • Quality profile
  • MQR mode versus Standard Experience
  • Project analysis token

Interview questions

  • Can you write a curl command to programmatically check a project's current quality gate status via the sonarqube web API, and explain what a response of status None means
  • A critical prod hotfix is ready to ship but the sonarqube quality gate fails on a new code smell (not a bug) introduced by the hotfix itself. The fix needs to go out in next 30 mins. What do you actually do?
  • Sonarqube's quality gate has been green for months, but a serious bug just shipped to production that, in hindsight, should have been obviously catchable by static analysis. How do you investigate whether this is a sonarqube configuration gap or an inherent limitation of static analysis.
  • How is the quality gate computed differently for a branch and for a pull request, and what is the fudge factor?
  • The scanner log says EXECUTION SUCCESS but the dashboard did not change and the pipeline's gate check passed on old data. Explain and fix.
  • How would you fail a CI pipeline on a red quality gate, and what are the trade-offs between sonar.qualitygate.wait, webhooks and polling the API?
  • SonarQube will not start after moving it to a new Kubernetes cluster, and es.log mentions vm.max_map_count. What do you do?
  • An admin's user token was pasted into a public CI log. Walk through your response.
  • Coverage on new code shows 0% although the tests run in the same pipeline. What do you check?
  • How do you plan an upgrade from SonarQube 9.9 LTA to the current LTA without losing data?
  • How do you prove nobody weakened the quality gate or the rules to get a release out?

Sign up free to read the full topic

More DevOps topics

Start free on Cariara · Coding problems · System design studio