Azure DevOps PR analysis failing: "Could not find the pullrequest with key"

  • ALM used: Azure DevOps
  • CI system used: Azure DevOps (SonarCloudAnalyze task 3.4.3, SonarScanner CLI 7.2.0.5079)
  • Languages: C#
  • Organization: (private)

Since Oct 6, 2026, all PR analyses in our organization fail at “Load branch configuration”. Branch analyses (manual runs) work fine. Nothing was changed on our side.

Error (from debug log):

GET https://sonarcloud.io/api/alm_integration/show_pullrequest?project=my-org_my-project&pullrequestKey=1234
HTTP 404: You don’t have permission, or the provided pullrequest with key ‘1234’ doesn’t exist.

What we have verified:

  • The PR exists and is active in Azure DevOps.
  • Organization binding shows Bound and the PAT shows Valid. We replaced the PAT today (scopes: Code Read & write, Code Status, Analytics Read). Same error.
  • The same PAT returns the PR through the Azure DevOps REST API.
  • Calling show_pullrequest directly with an organization admin’s personal token returns the same 404.
  • The Azure DevOps service connection token verifies successfully.
  • The project is bound, and the scanner sends correct PR parameters (sonar.pullrequest.vsts.instanceUrl, project, repository, key).
  • In Azure DevOps, IP Conditional Access validation is Off and third-party OAuth access is On.
  • Multiple projects in the organization are affected.

Could you check on the backend what Azure DevOps returns to SonarQube Cloud for this lookup?

Having the exact same issue (at least, I believe so)

It works for running the master branch, but when trying to run a pull request for a branch to master, returns:

##[error]ERROR: Error during SonarScanner execution
ERROR: Error during SonarScanner execution
##[error]ERROR: Could not find the pullrequest with key ‘6131’
ERROR: Could not find the pullrequest with key ‘6131’
##[error]ERROR: Caused by: GET https://sonarcloud.io/api/alm_integration/show_pullrequest failed with HTTP 404: You don’t have permission, or the provided pullrequest with key ‘6131’ doesn’t exist.
ERROR: Caused by: GET https://sonarcloud.io/api/alm_integration/show_pullrequest failed with HTTP 404: You don’t have permission, or the provided pullrequest with key ‘6131’ doesn’t exist.
##[error]ERROR:
ERROR:
##[error]The SonarScanner did not complete successfully
The SonarScanner did not complete successfully

We didn’t do anything on our end, and have already confirmed it’s not the token, since master branch works, and have tried an organization level token, for all organizations, with all permissions.

Having the same issue with Gitlab:

`ERROR: Something went wrong while trying to get the pullrequest with key ‘5413’: An unexpected error occurred. Please try again later.`

Hello @Abdul_Fazal and @JoaoSyone, thanks for reporting, there might be issue with our endpoint. I’m going to ask you privately for more details, mainly organization key, project key and PR key, so that we can check logs on our side.

@maxmantz your error message is different, perhaps you’re experiencing a different issue. In your case, are you getting a 500 error? Regardless, I’m going to reach out to ask you for project and analysis details too.

Hey all, I checked privately with @JoaoSyone and his problem seems to be PAT-related (the Azure PAT that you configure on the SonarQube Cloud org/project binding).

Our usual recommendation is to re-enter a fresh PAT in the SonarQube Cloud org’s Azure DevOps binding settings. It needs Code (Read & write) scope, and the PAT owner must still have access to the ADO project. Make sure the token wasn’t created under a different Azure organization or tenant. Reference docs here.

There’s a caveat: some projects may have a project-level PAT in their configuration. Please go to Administration > General Settings > Pull Requests. If the “Legacy project-level PAT detected” warning is shown, click on “Clear project-level PAT”. @Abdul_Fazal, since you have already tried with a new PAT at the org binding-level, maybe this is your issue.

If you have followed these steps and checked for the legacy project-level PAT, but the issue persists, then let me know, I might need to escalate this.

It finally worked for me, thank you so much.

The PAT was correct, was the token from Sonar to azuredevops that stopped working.

What was done:

  • In Sonarcloud, went to Organization, Organization settings, Organization bindings
  • Copied the azure token created, following the beginning of this tutorial: Importing Azure DevOps organization | SonarQube Cloud | Sonar Documentation In a quick summary, in azure devops, in personal tokens of the account you’re using to setup, generated a new token, and copied it to there

Again, thank you so much

Thanks Andrés. We’ve done everything suggested and the issue persists:

Replaced the PAT in the Organization binding (Code Read & write, Code Status, Analytics Read); it shows Valid.
No “Legacy project-level PAT detected” warning under the project’s Administration → General Settings → Pull Requests.
Repository binding shows the project correctly bound to Azure DevOps.
The PAT is from an account with access to the project, created in the correct Azure org/tenant.
The same PAT returns the PR via the Azure DevOps REST API, and calling show_pullrequest with an org admin’s token gives the same 404.
PR analysis still fails with HTTP 404 “Could not find the pullrequest with key”. Manual (non-PR) runs work fine. Could you escalate?

Hey @Abdul_Fazal, I’ll reach out to you via private message to ask for your project key so that we can check the back-end logs.

Sure. Thanks for the responce.