Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

ERROR: duplicate key value violates unique constraint "unq_lwr_username"

I can't import my confluence xml export due the the following errors:


postgres_confluence | 2020-05-11 03:46:57.299 UTC [318] ERROR: duplicate key value violates unique constraint "unq_lwr_username"
postgres_confluence | 2020-05-11 03:46:57.299 UTC [318] DETAIL: Key (lower_username)=() already exists.
postgres_confluence | 2020-05-11 03:46:57.299 UTC [318] STATEMENT: insert into user_mapping (username, lower_username, user_key) values ($1, $2, $3)
postgres_confluence | 2020-05-11 03:46:57.300 UTC [318] ERROR: current transaction is aborted, commands ignored until end of transaction block
postgres_confluence | 2020-05-11 03:46:57.300 UTC [318] STATEMENT: select 1

I have tried updating to v7 release and I still get the error. I found a bug report with a workaround, but I can't find any of the classes in my entities.xml. The bug-reporter is using cloud verison where I use the server version, perhaps that is why?> Can anybody help me workaround this issue, I have been struggling for days to fix it to no avail.


"Workaround" says to find

<object class="HibernateMembership" package="com.atlassian.crowd.embedded.hibernate2">

But of course, that doesn't exist in my export, but I get the same error.

2 answers

1 accepted

I was able to get past this by basically deleting all users, clearing almost everything from  `user_mapping` manually via sql and using the "recovery_admin" user to export/import and create a new user. Simple right?

Ran into this issue, but same resolution (I think?)


0 votes
Ismael Jimoh Community Leader May 10, 2020

Hi @FreeSoftwareServers 

It seems you have a user with the same lower user name as one that currently exists in your backup file.

This means you may need to first verify this conflict and resolve it before proceeding any further.

  1. Check for users with a similar username or the username is similar when you switch  to lower case version of the username.
  2. Either rename these users if you consider them as separate users or fix the username to be the exact same (possible one has block or mixed case while the other has all lowercase).
  3. once fixed, generate a new confluence back up and attempt reimport.


Let us know how this goes.

Sorry, not that simple as I have done lots of troubleshooting. I have only two users and I am importing into a brand new setup with only one user which is a different username. This is related to the XML export bug I linked which said I had to move the declarations around in entities.xml somehow, but I can't figure out how.

Literally 100% new Database + Confluence setup w/ Empty site and username of "admin" just to get "into" confluence, then I go into "restore" and select my XML backup and get the error above.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

Confluence Mythbusters: Does Atlassian even use Confluence?

Hi, Confluence collaborators! As part of #Confluence-Collaboratory month, we’ve created a very special Mythsbusters segment, where we're dive into an interesting myth and uncover the truth behind i...

1,749 views 8 32
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you