404 returned from api/alm_integration/show_pullrequest during sonar scan

This was working yesterday morning but has been consistently returning 404 ever since.

  • ALM used: Azure DevOps
  • CI system used: Azure DevOps
  • Languages of the repository: node & dotnet
  • Scanner command used when applicable (private details masked)
sonar-scanner     -Dsonar.login=*******    -Dproject.settings=sonar-project-****.properties     -Dsonar.pullrequest.key=****    -Dsonar.pullrequest.branch=******    -Dsonar.pullrequest.base=******     -Dsonar.pullrequest.vsts.instanceUrl=******     -Dsonar.pullrequest.vsts.project=****     -Dsonar.pullrequest.vsts.repository=***     -Dsonar.pullrequest.provider=vsts
  • Error observed:
sonar-scanner     -Dsonar.login=*******    -Dproject.settings=sonar-project-****.properties     -Dsonar.pullrequest.key=****    -Dsonar.pullrequest.branch=******    -Dsonar.pullrequest.base=******     -Dsonar.pullrequest.vsts.instanceUrl=******     -Dsonar.pullrequest.vsts.project=****     -Dsonar.pullrequest.vsts.repository=***     -Dsonar.pullrequest.provider=vsts
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: /workspace/sonar-project-****.properties
INFO: SonarScanner
INFO: Java 17.0.8 Alpine (64-bit)
INFO: Linux 5.19.0-28-generic amd64
INFO: User cache: /opt/sonar-scanner/.sonar/cache
INFO: Analyzing on SonarCloud
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Load global settings
INFO: Load global settings (done) | time=444ms
INFO: Server id: 1BD809FA-AWHW8ct9-T_TB3XqouNu
INFO: User cache: /opt/sonar-scanner/.sonar/cache
INFO: Loading required plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=333ms
INFO: Load/download plugins
INFO: Load/download plugins (done) | time=48ms
INFO: Load project settings for component key: '*********'
INFO: Load project settings for component key: '*********' (done) | time=384ms
INFO: Process project properties
INFO: Project key: *********
INFO: Base dir: /workspace
INFO: Working dir: /workspace/.scannerwork
INFO: Load project branches
INFO: Load project branches (done) | time=441ms
INFO: Check ALM binding of project '*********'
INFO: Detected project binding: BOUND
INFO: Check ALM binding of project '*********' (done) | time=305ms
INFO: Load project pull requests
INFO: Load project pull requests (done) | time=438ms
INFO: Load branch configuration
INFO: ------------------------------------------------------------------------
INFO: ------------------------------------------------------------------------
INFO: Total time: 4.313s
INFO: Final Memory: 11M/54M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
ERROR: Could not find the pullrequest with key '****'
ERROR: Caused by: Error 404 on https://sonarcloud.io/api/alm_integration/show_pullrequest?project=*********&pullrequestKey=**** : {"errors":[{"msg":"Unable to find the pullrequest with key \u0027****\u0027"}]}
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

I’ve tried running the scan with a different token but still returns the 404.
Also removing the token returns a different error so I don’t think it’s an authentication issue. (May be wrong).
Full debugging doesn’t really help. The error is clear though.

Caused by: org.sonarqube.ws.client.HttpException: Error 404 on https://sonarcloud.io/api/alm_integration/show_pullrequest?project=***********&pullrequestKey=**** : {"errors":[{"msg":"Unable to find the pullrequest with key \u0027****\u0027"}]}

Any help would be much appreciated.
Thank you.

1 Like

We have the same issue since yesterday. All PR builds fail with 404 on sonarcloud.

##[error]ERROR: Could not find the pullrequest with key ‘6071’
ERROR: Caused by: Error 404 on https://sonarcloud.io/api/alm_integration/show_pullrequest?project=[project]&pullrequestKey=6071 : {“errors”:[{“msg”:“Unable to find the pullrequest with key \u00276071\u0027”}]}

I have verified that our PAT has not expired. It’s only set at the Org level, and I can still import new Projects from the DevOps Org. Also, it says “is valid” on the PAT settings in SonarCloud.

hmm. One project had a weird branch instead of a PR listed (/refs/pullrequest/6071/merge or something like that) - deleted it and re-run the PR build, and it succeeded.

Another project just succeeded after 5 retries. - not sure what’s going on.

Thanks Michael, I checked our Azure DevOps PAT after your post.

Looks like our problem is just a case of an expired PAT at the Org level.

1 Like

Hi there, I have also been experiencing this 404 problem consistently since yesterday morning and can’t seem to overcome it.

ERROR: Caused by: Error 404 on https://sonarcloud.io/api/alm_integration/show_pullrequest?project={my_project}&pullrequestKey=443 : {"errors":[{"msg":"Unable to find the pullrequest with key \u0027443\u0027"}]}

PR definitely exists under the ADO project repository and I have tried recreating the PR and rerunning pipelines a few times.

In ADO I created a new PAT with full access scope and updated this in my SonarCloud project pull request settings.

I have also checked the service connection in ADO which verifies fine and replaced this with a new token from .


          - task: SonarCloudPrepare@1
            displayName: Prepare SonarCloud environment
              SonarCloud: "Sonar Cloud"
              organization: $(sonarcloud_organisation)
              scannerMode: "CLI"
              configMode: "manual"
              cliProjectKey: $(sonarcloud_project_key)
              cliProjectName: $(sonarcloud_project_name)
              cliSources: "."
          - task: SonarCloudAnalyze@1
            displayName: Analyse source code through SonarCloud
              jdkversion: "JAVA_HOME_17_X64"

Any further suggestions please?

Managed to resolve my issues as well!

For some reason I cannot see the place to enter the PAT under the Sonarcloud Organisation Azure Devops Connectivity Managements settings despite me being an Admin.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.