- Validation errors on namespaces and groups
- Find groups using an SQL query
- Transfer subgroup to another location using Rails console
- Find groups pending deletion using Rails console
- Delete a group using Rails console
- Find a user’s maximum permissions for a group or project
- Unable to remove billable members with badge
Project Invite/Group Invite
Troubleshooting groups
Validation errors on namespaces and groups
GitLab 14.4 and later performs the following checks when creating or updating namespaces or groups:
- Namespaces must not have parents.
- Group parents must be groups and not namespaces.
In the unlikely event that you see these errors in your GitLab installation, contact Support so that we can improve this validation.
Find groups using an SQL query
To find and store an array of groups based on an SQL query in the rails console:
# Finds groups and subgroups that end with '%oup'
Group.find_by_sql("SELECT * FROM namespaces WHERE name LIKE '%oup'")
=> [#<Group id:3 @test-group>, #<Group id:4 @template-group/template-subgroup>]
Transfer subgroup to another location using Rails console
If transferring a group doesn’t work through the UI or API, you may want to attempt the transfer in a Rails console session:
user = User.find_by_username('<username>')
group = Group.find_by_name("<group_name>")
## Set parent_group = nil to make the subgroup a top-level group
parent_group = Group.find_by(id: "<group_id>")
service = ::Groups::TransferService.new(group, user)
service.execute(parent_group)
Find groups pending deletion using Rails console
If you need to find all the groups that are pending deletion, you can use the following command in a Rails console session:
Group.all.each do |g|
if g.marked_for_deletion?
puts "Group ID: #{g.id}"
puts "Group name: #{g.name}"
puts "Group path: #{g.full_path}"
end
end
Delete a group using Rails console
At times, a group deletion may get stuck. If needed, in a Rails console session, you can attempt to delete a group using the following command:
GroupDestroyWorker.new.perform(group_id, user_id)
Find a user’s maximum permissions for a group or project
Administrators can find a user’s maximum permissions for a group or project.
- Start a Rails console session.
-
Run the following commands:
user = User.find_by_username 'username' project = Project.find_by_full_path 'group/project' user.max_member_access_for_project project.id
user = User.find_by_username 'username' group = Group.find_by_full_path 'group' user.max_member_access_for_group group.id
Unable to remove billable members with badge Project Invite/Group Invite
Members who were invited via a group invitation cannot be removed. You can either remove the entire group, or ask an Owner of the invited group to remove the member.
This error typically occurs when the user you’re trying to remove is part of an external group that has been shared with one or more of your projects or groups. To remove the user as a billable member, follow one of the options:
- Remove the invited group membership from your project or group members page.
- Recommended. Remove the user directly from the invited group, if you have access to the group.
The feature request to Update billable_members endpoint to include invited group is currently being worked on. For more information, see issue 386583