Pull request analysis targeting an analyzed short-lived branch succeeds but is missing from the SonarCloud UI
- ALM used: GitLab
- CI system used: Jenkins on Windows
- Scanner: SonarScanner CLI 8.1.0
- Repository language: C++
- SonarCloud plan: Paid plan
- Project visibility: Private
Scanner command
The relevant analysis parameters are:
-Dsonar.organization=<organization>
-Dsonar.projectBaseDir=C:/sl/MyProject/source/modules/MyProject
-Dsonar.scm.revision=<commit-sha>
-Dsonar.pullrequest.key=4
-Dsonar.pullrequest.branch=MySourceBranch
-Dsonar.pullrequest.base=MyTargetBranch
No sonar.branch.name or sonar.branch.target parameter is passed during this analysis.
Error observed
The scanner does not report any error. The Compute Engine task completes successfully:
{
"task": {
"id": "AaDUJDYrcwZ8Qc-16tSt",
"type": "REPORT",
"componentKey": "<organisation>_MyProject",
"componentName": "MyProject",
"analysisId": "d07a7653-46d0-4549-a03f-1ba8a3f4d05e",
"status": "SUCCESS",
"submittedAt": "2026-09-24T15:58:58+0000",
"pullRequest": "4",
"warningCount": 0
}
}
The Quality Gate result is also reported back to Jenkins and GitLab.
The pull request measures exist and can be retrieved through the Web API:
GET /api/measures/component?component=<organisation>_MyProjectI&pullRequest=4&metricKeys=alert_status
Response:
{
"component": {
"key": "<organisation>_MyProject",
"name": "MyProject",
"qualifier": "TRK",
"measures": [
{
"metric": "alert_status",
"value": "ERROR"
}
],
"pullRequest": "4"
}
}
However:
GET /api/project_pull_requests/list?project=<organisation>_MyProject
returns an empty pull request list.
The pull request is consequently absent from the SonarCloud Pull requests page. Following the SonarCloud link associated with the analysis opens a blank page inside the SonarCloud Web interface.
Steps to reproduce
- Analyze the target branch
MyTargetBranchas a branch analysis. - Open GitLab merge request
!4fromMySourceBranchintoMyTargetBranch. - Run SonarScanner with:
sonar.pullrequest.key=4
sonar.pullrequest.branch=MySourceBranch
sonar.pullrequest.base=MyTargetBranch
-
The analysis completes successfully and its measures can be queried using
pullRequest=4. -
The pull request remains absent from
/api/project_pull_requests/listand from the SonarCloud Web interface. -
Create or retarget a merge request from the same source branch to the SonarCloud main branch.
-
Run the same analysis, changing only
sonar.pullrequest.base. -
The pull request then appears correctly in the SonarCloud Web interface.
The branch MyTargetBranch had already been analyzed before the pull request analysis. It is classified as a short-lived branch in SonarCloud.
Potential workaround
Targeting the SonarCloud main branch makes the pull request analysis visible.
However, this does not cover workflows using stacked merge requests, where one feature branch temporarily targets another short-lived branch.
Is targeting an analyzed short-lived branch supported for pull request analysis? If it is supported, could this be an issue with the pull request list or Web interface?