Removing a user from a group in the internal directory fails
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
When removing a user from a group in the internal directory that does not exist in any other user directory, the following error message is shown to the user: No user named "<username>" was found
The same error is returned when deleting the user through the REST API.
With debug logging enabled, a line similar to the following appears in the atlassian-bitbucket.log:
"DELETE /rest/api/1.0/admin/users HTTP/1.1" c.a.s.i.r.e.ServiceExceptionMapper Mapping ServiceException to REST response 404
com.atlassian.bitbucket.user.NoSuchUserException: No user named '<username>' was found
Cause
The search for the user should continue until it is found in one of the user directories, but in this case it returns this error before it attempts to search the internal directory.
Resolution
Move the internal Bitbucket directory above all other user directories, to ensure it checks for the user in this directory first, then delete the user from the group.