-
Notifications
You must be signed in to change notification settings - Fork 1
Description
To verify. The logs recently showed the repeated error:
2026-03-08 20:27:43 | ERROR | app.core.auth.auth0_middleware | Error in user management: (sqlalchemy.dialects.postgresql.asyncpg.IntegrityError) <class 'asyncpg.exceptions.UniqueViolationError'>: duplicate key value violates unique constraint "ix_users_username"
DETAIL: Key (username)=(charettech) already exists.
[SQL: INSERT INTO users (auth0_id, email, username, is_active, last_login, id, created_at, updated_at) VALUES ($1::VARCHAR, $2::VARCHAR, $3::VARCHAR, $4::BOOLEAN, $5::TIMESTAMP WITH TIME ZONE, $6::UUID, $7::TIMESTAMP WITH TIME ZONE, $8::TIMESTAMP WITH TIME ZONE)]
[parameters: ('auth0|69add9b8317e3a964051275b', 'charettech@csslaurentides.gouv.qc.ca', 'charettech', True, datetime.datetime(2026, 3, 8, 20, 27, 43, 462227, tzinfo=datetime.timezone.utc), UUID('2faee736-411a-4369-889e-dbb122dde4f6'), datetime.datetime(2026, 3, 8, 20, 27, 43, 463019, tzinfo=datetime.timezone.utc), datetime.datetime(2026, 3, 8, 20, 27, 43, 463024, tzinfo=datetime.timezone.utc))]
(Background on this error at: https://sqlalche.me/e/20/gkpj)
2026-03-08 20:27:43 | ERROR | app.core.auth.auth0_middleware | Authentication error: 500: Error processing user data
Unclear on if username being unique is the reason this happens? My guess is this person registered with a similar-ish email.
The username becomes a proxy for lookups, and is basically everything before the "@" sign in the user email.
**Upon looking in auth 0 **there is a repeated username with two different emails (see the screenshot).
The likely fix is to remove the index on username in the database model file, or not enforce the unique constraint on the index.