Facing issue while deleting the Bitbucket Cloud Repository
Asked by Akshay b:

I am trying to delete a Bitbucket Cloud repository. I navigate through **Repository settings -\> Repository details -\> Manage repository -\> Delete repository -\> Delete.**

When I click on delete I get the below pop-up:

![Error.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/168863i6B87D32BBBFFC4EC/image-size/large?v=v2&px=999 "Error.JPG")

It's the same for last 1 day. When I checked with the Bitbucket Status Page, everything is operational.

**Additional Info**:

I am facing this issue in the repositories for which I had tried to rename the repository using REST API. For other repositories which I don't rename, I am able to delete it. I believe it's a bug from Bitbucket.


Answers:
author: Caroline R
body: Hi, [@Akshay b](/t5/user/viewprofilepage/user-id/4025953)!

Thank you for reaching out to Atlassian Community!

The "Something went wrong" message usually comes with a 5xx response that shows a Sentry ID code. This code may give us some indication of what is causing this issue. In this case, could you please follow the next steps to find the Sentry ID, so I can further investigate this case?

* Open the "Developer tools" in the browser you are using (click on the three dots \> More tools \> Developer Tools):

![devtools.png](https://community.atlassian.com/t5/image/serverpage/image-id/169166i96BB6ECEF96BFF3A/image-size/large?v=v2&px=999 "devtools.png")

* Then navigate to the Bitbucket page that gives you this error (try to delete the repo)

* In "Developer tools", select the **Network** tab

* Find and select the request that gives a 5xx response

* In the **Headers** panel (after you select the request with 5xx response), check if there is a field named **sentry id**.

If you can provide us with the value of that field, we can look it up in our system for further info.

Thank you.

Kind regards,  
Caroline

comments: author: Akshay b
body: Hi [@Caroline R](/t5/user/viewprofilepage/user-id/3934006) ,

Thanks for your response. Here is the sentry id: 1705cca4be6a42b09252b4b0cf461d09

![sentry_id.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/169174iFA9A68FC7CD1EB2C/image-size/large?v=v2&px=999 "sentry_id.JPG")

Hope this helps! Thanks!!


author: Caroline R
body: Hi, [@Akshay b](/t5/user/viewprofilepage/user-id/4025953),

Thanks for sharing the sentry code with us. I checked that and it corresponds to the below error:

    ProjectPrivacyException: A repository in a private project cannot be publicly visible.

So the repository you are trying to delete is set as public, but the project that has this repository is private. This is the cause of this issue.

In this case, you can set this repository as private by following the next steps and then try to delete the repo:

* Access the repository \> **Repository settings**;

* Under the **Repository details** section, find the "**This is a private repository**" option and check this box;

* Click **Save changes**.

Also, if you want to create a repository using the API and make it private, you can use the following request:

    curl -X POST -u username:AppPassword -H "Content-Type: application/json" -d '{"scm": "git", "is_private":"true", "project": { "key": "{inform_the_project_key_here}" } }' https://api.bitbucket.org/2.0/repositories/{workspacename}/{repository_name}

In case the "This is a private repository" option is disabled (grayed out), you can use the API to update the repo via a PUT:

    curl -X PUT -u username:AppPassword -H "Content-Type: application/json" -d '{"is_private": true}' https://api.bitbucket.org/2.0/repositories/{workspace_name}/{repository_name}

I hope this helps, but please let me know how it goes and if you have any questions.

Kind regards,  
Caroline


author: Akshay b
body: Thanks [@Caroline R](/t5/user/viewprofilepage/user-id/3934006)

"This is a private repository" option was disabled. So, I used the API to make the repository private and then was able to delete the repository successfully.


author: Caroline R
body: Hi, [@Akshay b](/t5/user/viewprofilepage/user-id/4025953)!

Thanks for getting back to us and confirming the API worked. I'm glad to know you were able to delete your repo!  
Kind regards,  
Caroline


Tags: bitbucket-cloud

cloud

delete

repository