Synchronization with LDAP fails Only deleted users can be archived

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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

Synchronization between Bitbucket Sever and an external LDAP fails.

The following appears in the atlassian-bitbucket.log

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 2016-05-04 10:28:23,990 ERROR [clusterScheduler_Worker-10] c.a.c.d.DbCachingDirectoryPoller Error occurred while refreshing the cache for directory [ 111111 ]. java.lang.IllegalArgumentException: Only deleted users can be archived at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122) ~[guava-18.0.jar:na] at com.atlassian.stash.internal.user.HibernateStashUserDao.archive(HibernateStashUserDao.java:66) ~[bitbucket-dao-impl-4.5.2.jar:na] at com.atlassian.stash.internal.crowd.HibernateUserDao.archiveIfNeeded(HibernateUserDao.java:297) ~[bitbucket-dao-impl-4.5.2.jar:na] at com.atlassian.stash.internal.crowd.HibernateUserDao.rename(HibernateUserDao.java:189) ~[bitbucket-dao-impl-4.5.2.jar:na] at com.atlassian.stash.internal.crowd.HibernateUserDao.rename(HibernateUserDao.java:63) ~[bitbucket-dao-impl-4.5.2.jar:na] at com.atlassian.crowd.directory.AbstractInternalDirectory.forceRenameUser(AbstractInternalDirectory.java:656) ~[crowd-persistence-2.8.4-m2.jar:na] at com.atlassian.crowd.directory.DbCachingRemoteChangeOperations.updateUsers(DbCachingRemoteChangeOperations.java:241) ~[crowd-core-2.8.4-m2.jar:na] at com.atlassian.crowd.directory.$Proxy1471.updateUsers(Unknown Source) ~[na:na] at com.atlassian.crowd.directory.DirectoryCacheImplUsingChangeOperations.addOrUpdateCachedUsers(DirectoryCacheImplUsingChangeOperations.java:62) ~[crowd-core-2.8.4-m2.jar:na] at com.atlassian.crowd.directory.ldap.cache.UsnChangedCacheRefresher.synchroniseAllUsers(UsnChangedCacheRefresher.java:195) ~[crowd-ldap-2.8.4-m2.jar:na] at com.atlassian.crowd.directory.ldap.cache.AbstractCacheRefresher.synchroniseAll(AbstractCacheRefresher.java:89) ~[crowd-ldap-2.8.4-m2.jar:na] at com.atlassian.crowd.directory.ldap.cache.UsnChangedCacheRefresher.synchroniseAll(UsnChangedCacheRefresher.java:168) ~[crowd-ldap-2.8.4-m2.jar:na] at com.atlassian.crowd.directory.DbCachingRemoteDirectory.synchroniseCache(DbCachingRemoteDirectory.java:1122) ~[crowd-core-2.8.4-m2.jar:na] at com.atlassian.crowd.manager.directory.DirectorySynchroniserImpl.synchronise(DirectorySynchroniserImpl.java:76) ~[crowd-core-2.8.4-m2.jar:na] at com.atlassian.crowd.directory.DbCachingDirectoryPoller.pollChanges(DbCachingDirectoryPoller.java:50) ~[crowd-core-2.8.4-m2.jar:na] at com.atlassian.crowd.manager.directory.monitor.poller.DirectoryPollerJobRunner.runJob(DirectoryPollerJobRunner.java:93) [crowd-core-2.8.4-m2.jar:na] at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:153) [atlassian-scheduler-core-1.7.0.jar:na] at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:118) [atlassian-scheduler-core-1.7.0.jar:na] at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:97) [atlassian-scheduler-core-1.7.0.jar:na] at com.atlassian.scheduler.quartz2.Quartz2Job.execute(Quartz2Job.java:32) [atlassian-scheduler-quartz2-1.7.0.jar:na] at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [quartz-2.2.2.jar:na] at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [quartz-2.2.2.jar:na] ... 60 frames trimmed

Workaround

  1. Disable the external user directory from within Bitbucket Server

  2. Add a new user directory to Bitbucket Server with the same settings the one that has failed the sync but with a different name

  3. Test the sync between the newly added user directory and Bitbucket Server

  4. If the sync is successful, disable the user directory and test the previous directory

The issue should be resolved. If the initial directory still does not sync and new directory does, use the new directory and remove the old one.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.