Fresh Installation fails because user email violates unique constraint

I am trying to install Lemmy, I am using a modified ansible role so that it deploys the DB on an external postgresql instead of a docker one.

Installation always fails with

lemmy_1     | thread 'main' panicked at 'couldnt create local user: DatabaseError(UniqueViolation, "duplicate key value violates unique constraint "local_user_email_key"")', crates/db_schema/src/impls/local_us
er.rs:157:8

The tables seem created and the admin user exists in them, so I'm not sure what else it's trying to create and has a duplicate email.

Earlier I also noticed this once, but I don't know if it's relevant

lemmy_1     | Error: LemmyError { message: None, inner: value too long for type character varying(20), context: "SpanTrace" }

This one only seems to appeared the one time.

I tried dropping and recreating the DB. same issue everytime.

beto,
@beto@lemmy.studio avatar

This happened with me because I was adding an admin account explicitly to the hjson file. Once I removed that everything worked.

db0,
@db0@lemmy.ml avatar

I was doing that as well, but it wasn't the problem. The problem was apparently caused by a too-long site name

db0,
@db0@lemmy.ml avatar

I managed to get it to run. I checked in postgresql logs and it seems it was caused by trying to add into site. Apparently the site name cannot be more than 20 chars but this is mentioned nowhere in the documentation.

And when this happens, it causes this cascade of somehow trying to recreate the admin again and again, which is a red herring after all.

kiwi,

wow very tricky, thanks for reporting back! Can I ask if you’re seeing better performance running postgresql separately?

db0,
@db0@lemmy.ml avatar

I don't have something to compare it to. As it's still empty, performance is still good.

mrwiggles,

Yeah, I encountered this too, but only when deciding to rename the site. When I renamed it through the lemmy UI I was able to find the character limitation and work around it. I bet it has something to do with the federation protocol, and how much memory is allocated to a site's name.

db0,
@db0@lemmy.ml avatar

I dropped the contraints manually to test, and it indeed seems to create the admin account 3 times for some reason!

db0,
@db0@lemmy.ml avatar

Worse. Restarting the container, seems to keep recreating that user 3 times again. Then always fails with

lemmy_1     | Error: LemmyError { message: None, inner: value too long for type character varying(20), context: "SpanTrace" }

  • All
  • Subscribed
  • Moderated
  • Favorites
  • lemmy_support@lemmy.ml
  • osvaldo12
  • DreamBathrooms
  • ngwrru68w68
  • Durango
  • mdbf
  • magazineikmin
  • everett
  • thenastyranch
  • rosin
  • Youngstown
  • slotface
  • khanakhh
  • kavyap
  • GTA5RPClips
  • megavids
  • tacticalgear
  • cubers
  • modclub
  • tester
  • InstantRegret
  • ethstaker
  • cisconetworking
  • anitta
  • provamag3
  • Leos
  • normalnudes
  • JUstTest
  • lostlight
  • All magazines