ERROR: You don't have permission, or the provided pullrequest with key '1234' doesn't exist

Hi,

We were running SonarCloud sucesfully for a mount, but today all pull requests started to fail with the following error.

##[error]ERROR: Error during SonarScanner execution
ERROR: Could not find the pullrequest with key '1234'
ERROR: Error during SonarScanner execution
ERROR: Could not find the pullrequest with key '1234'
##[error]ERROR: Caused by: Error 404 on https://sonarcloud.io/api/alm_integration/show_pullrequest?project=Company_Project&pullrequestKey=1234 : {"errors":[{"msg":"You don\u0027t have permission, or the provided pullrequest with key \u00271234\u0027 doesn\u0027t exist."}]}
ERROR:
ERROR: Caused by: Error 404 on https://sonarcloud.io/api/alm_integration/show_pullrequest?project=Company_Project&pullrequestKey=1234 : {"errors":[{"msg":"You don\u0027t have permission, or the provided pullrequest with key \u00271234\u0027 doesn\u0027t exist."}]}
ERROR: 
INFO: ------------------------------------------------------------------------
##[error]The SonarScanner did not complete successfully
The SonarScanner did not complete successfully
##[error]07:37:49.469  Post-processing failed. Exit code: 1
07:37:49.469  Post-processing failed. Exit code: 1

##[error][ERROR] SonarQube Cloud: Error while executing task Analyze: The process 'C:\agent\_work\_tasks\SonarCloudPrepare_14d9cde6-c1da-4d55-aa01-2965cd301255\3.4.3\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe' failed with exit code 1
##[error]The process 'C:\agent\_work\_tasks\SonarCloudPrepare_14d9cde6-c1da-4d55-aa01-2965cd301255\3.4.3\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe' failed with exit code 1
Finishing: SonarCloudAnalyze

I thaught the error is caused by the expiration of the acces token, so I created a new one

And I set it in Sonar Cloud

Unfortunatelly, the error persists also after setting the token.

We are using the AzurePipeline Integration

Can you give me any suggestion what can I check?

Thank you

PS: I dobble checked that I entered the whole string.

Hi,

Many systems will return a 404 error (i.e. what you’ve asked for doesn’t exist) rather than a 403 error, thus admitting that the resource exists but you just don’t have access to it.

You should double-check the PAT you’ve configured SonarQube Cloud with. Note that there are two possible places for this: at the global level and at the project level.

 
HTH,
Ann

Hi Ann,

thank you for your feedback.

I did some further investigations:

  • I copied the Azure generated token directly to Sonarcloud Administration / General Settings / sonar.pullrequest.vsts.token.secured but the error persists. I assume this is the “project level token“

  • I searched for the “the global level token”, and I found: “My Account / Security” page which has a token is that what you meant?

  • On Azure I verified the Service Connection (works)

  • I started a PR anylysis and a branch analysis. The first failed the former succeeded

  • I tried to navigate the failing url in the browser. It fals with the same 404 error. Than I entered the pull request key of a branch existing in Sonar and failed with the same error.

  • Note that the failing url is the one pointing on SonarCloud. I wander why the SonarCloudPrepare@3 works, but SonarCloudAnalyze@3 failes because cannot reach an URL, pointing on SonarCloud.

    • As SonarCloud does build/analysis optimization, I would expect, the connection from Azure to SonarCloud has been established before than SonarCloudAnalyze@3 (to get what needs to be anylyzed)
    • I would also expect SonarCloudAnalyze@3 to generate an URL that can be reached, or?

Can you please tell me if I missed something. Ar the location of “at the global level and at the project level PAT“ what yo meant?

Thank you

We have the exact same issue.

Our PAT is valid till 6/23/2026 but all of the sudden these 404 errors started to appear.

{"errors":[{"msg":"You don\u0027t have permission, or the provided pullrequest with key \u002752700\u0027 doesn\u0027t exist."}]}

We are still investigating on our end, but we did verify that the PAT used by SonarCloud is valid and still working.

Edit:
Regenerated our Azure Devops PAT, but while submitting it to SonarCloud it claims the new PAT is invalid;

The curious part is that the other way around from ADO –> SQ also does not work anymore;

Hi @kricer,

Can you provide your analysis log?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

@PeterBa it really doesn’t matter what your PAT expiration date is; Azure requires that the user log in every 30 days or it kills the PAT regardless of the expiration. Since you’re currently experiencing something different than the OP, can you create a new thread with all your details, please?

 
Thx,
Ann

Hi Ann,

please find the analysis log attached.

I hope you can find a clue in it.

analysis.log (16.6 MB)

Hi,

Thanks for the log. Here’s what I see in it:

So we have a manually-configured PR, and then a 404 on retrieving that PR. So either it’s a permissions error, as I advised above, or you should drop your manual PR configuration and let analysis pick it up automatically from the environment.

 
HTH,
Ann

Hi Ann,

thank you for the feedback, I double checked the PAT and indeed, it was expired.

As an additional info, I want to say, that I was a little becaus there are different places to set the PAT (in projects and in organization). For the comunity I list below the link to these places:

  • Organization Settings (Organization binding): https: //sonarcloud .io/project/settings?id=[project-id]
  • Project General Settings: https: //sonarcloud .io/project/settings?id=[project-id]

Please note the spaces - to prevent auto generating links

1 Like