Analysis on PRs fail with "Could not find the pullrequest" error when triggered from Azure DevOps

Hi,

I have the below issue.
Could you please help?

ALM used: Azure DevOps
CI system used: Azure DevOps
Scanner command used when applicable (private details masked):

  inputs:
    SonarCloud: 'sonarcloud'
    organization: 'xxx'
    scannerMode: 'MSBuild'
    projectKey: 'xxx'
    projectName: 'xxx'
  • Languages of the repository: C#

  • Error observed:

ERROR: Error during SonarScanner execution
##[error]ERROR: Could not find the pullrequest with key '1086'
ERROR: Caused by: Error 404 on https://sonarcloud.io/api/alm_integration/show_pullrequest?project=xxx&pullrequestKey=1086 : {"errors":[{"msg":"Unable to find the pullrequest with key \u00271086\u0027"}]}
ERROR:
ERROR: Could not find the pullrequest with key '1086'
ERROR: Caused by: Error 404 on https://sonarcloud.io/api/alm_integration/show_pullrequest?project=xxx&pullrequestKey=1086 : {"errors":[{"msg":"Unable to find the pullrequest with key \u00271086\u0027"}]}
ERROR:
##[error]The SonarScanner did not complete successfully

Steps to reproduce:
It happens at every pipeline run. No special steps needed to reproduce.

Analysis works fine for any branches and it did work for PRs as well just a few weeks ago. No change in sonarcloud and no change in DevOps was made.

I already tried to revoke and regenerate the token - but that did not solve the issue.

This thread helped me finding the root cause:

With the exception that in my case the Personal Access Token (PAT) configured for the project was still valid, but the one set on Ogranisation level was expired.

To change the PAT on the organisation level go to:
Administration > Oragnization settings > Azure DevOps connectivity management

The error message (404 on the PR) is very confusing and it did not help debugging the situation. We lost a couple of days to this misleading error message. Please fix it.

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