Problem with "Analyze projects" project cannot be imported because sonarcloud see it as imported

  • ALM used: GitLab
  • CI system used: GitLab CI
  • Languages of the repository: Python
  • Error observed errors: [{msg: "Project doesn't exist"}]
  • Steps to reproduce:
  1. Click on “Analyze new project”
  2. During page load API request is done: "https://sonarcloud.io/api/alm_integration/list_repositories?organization=someorg
    it return records with record for test-project
    {
    “label”: “test-project”,
    “installationKey”: “somekey”,
    “linkedProjects”: [
    {
    “key”: “someorg_test-project”,
    “name”: “test-project”
    }
    ],
    “private”: true
    },
  3. In search box enter name of the project (let’s say “test-project”)
  4. Project found with status “Already imported”
  5. When I click on it - I can see page with " The requested project does not exist, or you have not been granted access."
  • Problem: So I cannot import project, cannot delete it to import again

Hey there.

This typically happens for one of two reasons:

  • Someone has created the project in your organization, but for whatever reason (usually a misconfigured permission template), you don’t have access to that project. This thread can help you out
  • Somebody previously imported your Gitlab group into SonarCloud and stopped using SonarCloud, but the project binding is still active. This is usually quite complicated to fix unless you can track down the admin of whoever tried using SonarCloud in your org before.

Is someorg your organization key, or something else?

Thank you Colin. Yes, ‘someorg’ - is customer organization (). But I also have owner rights (real name replaced with this value)

If this could help - I can see by following this link https://sonarcloud.io/organizations/someorg/edit

In block “Key”:

someorg

Other projects have keys someorg_test-project2, someorg_test-project3 there more than 60 projects and problem is only with this one.

Is it possible to delete this blocking us record on Sonar side?
(there is no possibility to rename gitlab project to avoid issue)
And than we will be able to import it.

Regards, Anton D.

In that case, if the project belongs to an organization you have access to, I think we’re back to this point

Colin thank you for extend and detail instructions
Have check the calls:

curl --header 'Authorization: Bearer <sometoken>' -X POST 'https://sonarcloud.io/api/permissions/add_user?projectKey=someorg_test-project&login=<someuser>@gitlab&permission=admin&organization=someorg'
Get 400 response with body: {"errors":[{"msg":"Organization key is incorrect."}]}

But when I try do same for another project someorg_working-project that has no issue:

curl --header 'Authorization: Bearer <sometoken>' -X POST 'https://sonarcloud.io/api/permissions/add_user?projectKey=someorg_working-project&login=<someuser>@gitlab&permission=admin&organization=someorg'
I get 204 response code

This block to move forward to DELETE API call, probably there are some other possible ways to overcome it?

I’ve reached out to you via PM for the unredacted API calls.

thx, reply in PM

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

It turned out the project belonged to another organization. Once deleting that project, the project could be imported in the new org.