Unable to remove a user from a workspace in Bitbucket Cloud
Platform Notice: Cloud Only - This article only applies to Atlassian apps on the cloud platform.
Summary
When a workspace admin tries to remove a specific user from a Bitbucket Cloud workspace, the user is not removed, and the following error appears in the bottom left corner of the screen:
Unexpected token '<', "<!DOCTYPE "... is not valid JSON
Every Bitbucket user with access to the workspace is a billable user, and a workspace admin may want to remove a user who is no longer with their company.
Cause
A workspace admin can't remove this user's access from the workspace because it is the user's workspace.
Before February 2023, when someone created a Bitbucket Cloud account, Bitbucket would automatically create a workspace for them. This workspace is tied to the user and is considered their personal workspace.
Since February 2023, Bitbucket no longer creates a workspace automatically when a user signs up.
For existing personal workspaces, a user can't be removed from their workspace.
Solution
Please remember that if you delete the Atlassian account of the user associated with the personal workspace, then the workspace and all repositories under it will no longer be accessible.
If you have already deleted the account, you can cancel it within 14 days by logging in to the account; then, the account and access to the workspace will be restored. Otherwise, when 14 days pass, the workspace and repositories will be deleted.
We suggest one of the following two options instead, and you can delete the user's account if you want after following Option 1.
Option 1: Create a new shared workspace and transfer the repositories from the personal workspace:
You can create a new workspace, recreate projects, transfer the repositories from the existing personal workspace to the new one, and setup user access in this new workspace.
A workspace you create manually is not considered a personal workspace, so you will not face the same issue with user removal in the future.
Please keep in mind that the new workspace you create will have a different ID from the existing one, so the URL of the repositories will change once you transfer the repos. If you want to keep the same ID in the new workspace:
You will first need to change the ID of the existing personal workspace to a different one in order to free up the ID.
If you still get an error that the ID is taken after changing the personal workspace's ID, the user you were trying to remove likely has the same username as the ID. You must change the user's username to free up the ID. You will need access to the user's email to log in to the account and change their username. If this is not possible, you must use a different ID for the workspace.
2. Check what projects the old personal workspace has in https://bitbucket.org/workspace-id/workspace/projects/ (replace workspace-id in the URL with the ID of the personal workspace). If you want to keep the project structure, create these projects in the new workspace you created in the previous step.
3. Transfer the repositories from the old personal workspace to the new one you created in Step 1.
4. Recreate user groups and invite users.
Any new Bitbucket workspace you create has user management in Atlassian Administration. Default groups are created for your Bitbucket workspace in Atlassian Administration, but you can also create new groups. Please see the documentation on how to see the default groups, create new ones, and how to invite users.
5. Finally, you must grant these groups access to specific Bitbucket projects or repositories. Only the administrator's default group is added to the Bitbucket projects and repositories.
If you grant a user group access to a Bitbucket project, this user group will have access to all existing and new repositories under this project. You can do it the following way:
While viewing your new workspace on Bitbucket's website, https://bitbucket.org/workspace-id (replace workspace-id in the URL with the ID of the new workspace), select Projects on the top navigation bar to display a list of projects within the current workspace.
Select a particular project.
Select Project settings on the left sidebar.
Select Project permissions under the General heading on the left sidebar.
Select Add users or groups to add to the project and assign them permissions within the project.
Enter the group by name.
Select the permissions dropdown (currently displaying Read by default) and select the permission you want to set for this group.
Select Confirm to save your updates.
Alternatively, you can add a user group to a specific repository only:
Open the repository on Bitbucket's website
Select Repository settings on the left sidebar
Select Repository permissions on the new left sidebar
Select Add users or groups to add a user group to the repository.
Enter the group by name.
Select the permissions dropdown (currently displaying Read, by default) and select the permission you want to set for this group.
Select Confirm to save your updates.
Option 2: Change the primary email address associated with the personal workspace / Transfer ownership:
If the user you are trying to remove from the workspace has a company email address that you can access with the help of your IT department, you can change the primary email address of the user's Bitbucket account to another email address that will be used to access the account from then on.
Please remember that with this option, you are not removing the user from the workspace; the total number of billable users will remain the same. You are only changing the email address of the user's account to one that you or another person in your company will use.
ℹ️ Please note that the email address you wish to change to should not have an existing Bitbucket account.
If you have gained access to the user's company email address, you can reset the Bitbucket account's password via this link: https://id.atlassian.com/login/resetpassword
After resetting the password, log in to https://bitbucket.org/ with the user's email address.
Follow these steps to change the email address of the user's Atlassian account to a new one.
⚠️ If you can't change the user's email address because an Atlassian account already exists with this email address, you can do the following:
Log in to https://bitbucket.org/ with the user's email address
Select Administration> Personal Bitbucket settings
Add the new email address as an email alias to the Bitbucket account.
Once you have added the email address as an alias, you can reach out to the Bitbucket Cloud support team to switch the account's primary email address to the alias.
If you are on the Free plan, you can create a question in the community. Please don't share email addresses in the community, as it is a public forum. You can log in to the community with the email address of the affected user and create your question, and then Atlassian staff will help you.
Was this helpful?