Unable to find the pullrequest with key `X`

hi, i hve an issues when running scanner for merge_requests, but its running well when scan master, development

the error log like this

Caused by: Error 404 on [MASKED]/api/alm_integration/show_pullrequest?project=xyz&pullrequestKey=1263 : {"errors":[{"msg":"Unable to find the pullrequest with key \u00271263\u0027"}]}

Hi,

Welcome to the community!

Does the PR number in the error message exist in GitLab?

 
Ann

yaps, the PR its already on Gitlab.

But, When i to go to sonarCcloud UI → Pull Request, its empty state like this

Hi,

Could you

  • double check the auth token and make sure it hasn’t expired
  • click on the GitLab icon in the UI and make sure that the PR exists in the repo you land in?

 
Ann

it’s not expired i think, cause its running well for master and development branch. just issues for merge request.

the PR is exist

any suggestion @ganncamp?

Hi,

Can you click on the GitLab icon in the UI and make sure that the PR exists in the repo you land in?

 
Ann

yap its exists in repo

Hi,

We’ve checked the logs, and SonarCloud is getting a 404 for the merge request URL.

Can you double check the project id in the URL is the same as the one that shows up in your GitLab repo in the top of the UI?

Note also that GitLab will return a 404 for a valid URL if the person/account making the request doesn’t have permissions to access it. So this could be a question of the access token you’ve configured for SonarCloud to use. Can you try accessing that URL using the same token you’ve configured for SonarCloud to use?

 
Ann

Hi,

I have exactly the same issue. I have integrated the gitlab-ci to run the sonar on merge-requests but it fails every time and I can see within the logs that MR can’t be found by SonarApi:

Caused by: Could not find the pullrequest with key '110'
Caused by: org.sonarqube.ws.client.HttpException: Error 404 on https://sonarcloud.io/api/alm_integration/show_pullrequest?project=parkhere_invoice-event-processor&pullrequestKey=110 : {"errors":[{"msg":"Unable to find the pullrequest with key \u0027110\u0027"}]}

When I check the dashboard, I see exactly the same screen as it’s posted by Raka_Adi_Nugroho .

Just to make sure, I created a MR manually and refreshed the UI and still the same.

I will appreciate your advice how to resolve this issue.

Thanks

Any advice for this issue? It’s a bit urgent for us. Thank you

Who can help on this topic what @ Esfandiyar_Talebi mentioned?

Thanks a lot

Hi @Esfandiyar_Talebi & @TomMunich4,

When you “me too” on a thread that ends by asking the user to double-check some stuff without actually responding to the request… there’s not much to say on our side.

So, what is your response to this?

 
Ann

1 Like

Hi Ann,

Thanks for your reply. I already checked the access token is set correctly. We actually can import a project from our gitlab repo to sonar dashboard without any issue and can run the code analysis and test coverage on those projects by manually running the gradle in local. This part works fine.

Now, we want to integrate the sonar with our gitlab CI/CD pipeline to run the sonar tasks on merge requests. The problem is when I create a MR in Gitlab for a specific project, the MR does not appear in our SonarCloud dashboard and that could be the reason why the pipeline also fails when I use the merge_requests rule for my stage. The pipeline works fine if I don’t use “merge_requests” rule.

I was wondering if we can somehow troubleshoot the integration of gitlab and sonarcould through some logs. I hope the above explanation helps.

Thanks
Esfandiyar

Hi Esfandiyar,

This deserves its own thread. With logs &etc.

 
Ann

I also bumped into similar error . We were not able to scan and analyze report for pull requests specifically.

We figured out that we have selected wrong project when adding a project. We have multiple projects with same name under different groups and that made it confusing to select .

Not sure if that applies to all but we were at the same status before we figured this out.

You can refer this topic if it helps you.

Thanks

1 Like