ERROR: Could not find the pullrequest with key '976'

Template for a good new topic, formatted with Markdown:

  • ALM used : Azure DevOps
  • CI system used : Azure DevOps
  • Scanner command used when applicable (private details masked)
  • Languages of the repository : PHP
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)

=============================================================
##[error]ERROR: Error during SonarScanner execution
ERROR: Could not find the pullrequest with key ‘976’
ERROR: Caused by: Error 404 on https://sonarcloud.io/api/alm_integration/show_pullrequest?project=XXXXXXXXXX&pullrequestKey=976 : {“errors”:[{“msg”:“Requested resource wasn\u0027t found on Azure DevOps.”,“reason”:“AZURE_DEVOPS_UNABLE_TO_FETCH_REQUESTED_RESOURCE”}]}
ERROR:
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
ERROR: Error during SonarScanner execution
ERROR: Could not find the pullrequest with key ‘976’

  • Steps to reproduce
    =>Run analysis for Pull request

Please note :
Our source code is hosted on bitbucket cloud
We are using Azur DevOps CI pipelines for build
Our Project is Bound to Azure DevOps

Few questions came in mind while investigating this issue:
can we change project bound (Azure DevOps to Bitbucket vice versa)
Where we can find alm setting key / is there any way we can update project bound from API

Hey there.

An entire organization in SonarCloud can only be mapped to one DevOps Platform (BitBucket, Azure Devops, etc.).

It sounds like your organization is bound to Azure DevOps but trying to analyze pull requests hosted on BitBucket Cloud, which is not a supported scenario. In this error – SonarCloud is trying to look up a pull request on Azure DevOps… but doesn’t exist because the pull request is on Bitbucket.

At most, you would be able to run analysis on a manual (unbound) project, but would not be able to benefit from PR Decoration. You could also maintain a separate organization for your projects that are hosted on Bitbucket Cloud (and still use Azure DevOps as the CI).