SonarCloud is not detecting my PRs in Azure DevOps (API Error 404)

Message:

Hi community,

I’m facing an issue with the SonarCloud and Azure DevOps integration for PR scanning. It was working fine before, but now SonarCloud is not detecting my PRs and returns a 404 error when trying to fetch them.

← 404 https://sonarcloud.io/api/alm_integration/show_pullrequest?project=example-key-proyect&pullrequestKey=390824
17:29:09.049 ERROR Could not find the pullrequest with key ‘390824’

Problem details:

  • I use Azure DevOps with a YAML pipeline that runs Sonar analysis on PRs.
  • The variables are correctly set, as System.PullRequest.PullRequestId retrieves the correct PR ID.
  • The PR does exist in Azure DevOps and is open.
  • The SonarCloud token has full access permissions.
  • However, the SonarCloud API returns: ← 404 https://sonarcloud.io/api/alm_integration/show_pullrequest?project=example-poroject&pullrequestKey=390824
    17:29:09.049 ERROR Could not find the pullrequest with key ‘390824’
    properties:
    sonar.pullrequest.key=$(System.PullRequest.PullRequestId) sonar.pullrequest.branch=$(Build.Repository.Name)@$(sourceBranchName)
    sonar.pullrequest.base=$(Build.Repository.Name)@$(targetBranchName)
  • I checked in SonarCloud → Project → Pull Requests, and the PR does not appear in the list.

What I have tried:

  1. Verified the Azure DevOps integration in SonarCloud, and it is properly configured.
  2. Checked in SonarCloud → Administration → Background Tasks, and no recent PR analysis appears.
  3. Ran sonar-scanner manually with the correct parameters, but the PR is still not detected.
  4. Tried with a new PR, but it is also not recognized.

Questions:

  1. Is there any additional configuration that could be affecting PR detection?
  2. How can I force SonarCloud to resync with Azure DevOps to recognize PRs again?
  3. Has anyone else experienced a similar issue recently?

Any help or suggestions would be greatly appreciated. Thanks!

Have you double-checked that the token set in your global Administration > Organization Settings > Organization binding is valid?

1 Like

Hello,

thank you very much for your help. The token had indeed expired. I would like the error message to be more descriptive in these scenarios.

Have a great day!

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