Could not find the pull request with key ‘XXXX’ error in Azure devops pipeline for existing project

We are running a sonar scan analysis on main branch then the scan is successful. But when we are integrating the sonar scan analysis in pull request it is giving error “Could not find the pull request with key xxxx”.

We also tried renewing the token but that also didn’t work. I do not want to have to recreate these projects.

What could be the possible reason for the same.

Hey there.

I’m not sure which token you updated, but if the issue appears only in Pull/Merge Request pipelines, then most likely the token set in your global Administration > Organization Settings > Organization binding is no longer valid. This token is used to query information about the pull/merge request during analysis.

(and yes, it’s very annoying that the error message isn’t more clear about this :()

Can you check this point?