User directory fails to sync with Confluence due to 'Unable to find user mapping' error

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.


External directory fails to synchronize with Confluence.

The following appears in the atlassian-confluence.log

2017-04-20 16:20:26,901 ERROR [Caesium-1-2] [atlassian.confluence.event.ConfluenceEventDispatcher] run There was an exception thrown trying to dispatch event [com.atlassian.crowd.event.user.UserEditedEvent@35de7957] from the invoker [com.atlassian.confluence.event.ConfluenceListenerHandlersConfiguration$TimingListenerHandler$1$1@3f8cf28]
java.lang.RuntimeException: Unable to find user mapping for charlie


Diagnostic Steps

For every entry in cwd_user, there should be one entry with a matching lower user name in the user_mapping table. However, for the user in this error, the entry is missing. In the example above, I'm using 'charlie' as the user that is affected.

Run the following query to find any users that are affected by this:

SELECT * FROM cwd_user WHERE lower_user_name NOT IN (SELECT lower_username FROM user_mapping);


Always back up Confluence before removing or modifying any data on it

  • Shutdown Confluence and backup your database
  • Remove the user(s) from the database:

    SELECT id FROM cwd_user WHERE lower_user_name = 'charlie';
    /* Use the ID value from this SELECT query to run the next set of queries */
    DELETE FROM cwd_user_credential_record WHERE user_id = '<id_from_select_query>';
    DELETE FROM cwd_membership WHERE child_user_id = '<id_from_select_query>';
    DELETE FROM cwd_user_attribute WHERE user_id = '<id_from_select_query>';
    DELETE FROM cwd_user WHERE id = '<id_from_select_query>';
  • Restart and trigger a sync again

Last modified on Nov 2, 2018

Was this helpful?

Provide feedback about this article
Powered by Confluence and Scroll Viewport.