Error "Could not find the pullrequest with key" after moving from monorepo

In our organization, we are using SonarCloud with Azure DevOps. We had Sonar running successfully on our PR and CI builds in our monorepo, but are splitting the repository into separate repos for easier administration.
Currently, when running a PR build on the new repository, the code analysis task fails with error
ERROR: Could not find the pullrequest with key ‘22740’
ERROR: Caused by: Error 404 on https://sonarcloud.io/api/alm_integration/show_pullrequest?project=PS.AzureFunctions.CaRe&pullrequestKey=22740 : {“errors”:[{“msg”:“Requested resource wasn\u0027t found on Azure DevOps.”,“reason”:“AZURE_DEVOPS_UNABLE_TO_FETCH_REQUESTED_RESOURCE”}]}

I can confirm that the pull request with this key exists, but in the new repository. I can also see pull requests and branches from the old repository still in Sonar.

Is it at all possible to start using a new repository with an existing sonar project? What would be the necessary steps for this?

Cheers,

Nikola

Hey @nikolacace

If the original project is bound, then unfortunately you will keep receiving this error when analyzing another repository.

  • It’s not possible to rebind a project to another repository
  • We have some improvements in mind regarding this step in the scanner (detecting PR information) that would improve the situation but not fix the root issue (the project would remain bound to a repo it technically doesn’t represent anymore)

It’s an interesting use-case so I’ll ping around internally to give it some visibility (or maybe there’s a workaround I’m not aware of)

Hi @Colin

Thanks for the response, I was afraid that would be the answer…
However, just to be clear, the project will remain in the same organization, we are just moving it to another repo (from a generic Code repo to its specific name). The organization binding will remain the same, only the project binding will change. I’m guessing the answer remains the same? :slight_smile:

If there’s a workaround, I’m all ears…