IncorrectResultSizeDataAccessException when logging in

When trying to login to Confluence with our admin account the following error is displayed:


org.springframework.dao.IncorrectResultSizeDataAccessException: query did not return a unique result: 2
    at org.springframework.orm.hibernate.SessionFactoryUtils.convertHibernateAccessException(


I have checked the cwd_users table and there are no duplicate usernames.

What else might I need to check to identify the root cause of this issue?

1 answer

1 vote


In order to resolve this issue, there are two suggested resolutions from this page:

User login renders 'query did not return a unique result' error

Give both of those suggestions a try and let us know how it goes. You can try resolution #1 first, and if that does not work, try #2, searching the cwd_user table for the specific username that is having the problem.

Let us know if you have any trouble or if the solutions do not correct your issue.

Kind Regards,

Hi @Shannon Spaniol!

I had seen that article aready, but as I stated above our cwd_users table does not contain any duplicate usernames.

I cannot try resolution #1 as we only have one administrative user, and that's the one that cannot login.

I cannot try resolution #2 as there are no duplicated usernames in the cwd_table to delete.

Do you have any other suggestions?

Hi there,

So this means that the duplicate row is in another table. For example, user_mapping could have a duplicate.

My recommendation to you would be to turn on SQL Logging and then you will be able to see which SQL statement is causing the error.

Let us know how it goes or if you have any follow-up questions.

Kind Regards,

Thanks @Shannon Spaniol!

With SQL Logging enabled I was able to indentify that this query was returning two rows:

confluence0_.user_key as user_key,
confluence0_.username as username,
confluence0_.lower_username as lower_us3_
user_mapping confluence0_

I edited the values of username and lower_username on one of the rows, and the issue was resolved.

I'm happy to hear the SQL logging was able to help you resolve your issue!

Take care and Kind Regards,

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Organizing your space just got easier - Page Tree Drag & Drop is here

Hi Community! I’m Elaine, Confluence Product Manager. You may have read my earlier post about page tree in space navigation sidebar. I'm excited to share another improvement that helps you organize ...

150 views 3 4
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you