In JetBrains TeamCity prior to 2020.2.1, permissions during user deletion were checked improperly.
jetbrains teamcity