learningequality / learningequality/studio

IntegrityError: duplicate key value violates unique constraint "contentcuration_user_email_key"

Open
#3,050 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P1 - important TAG: regression TAG: tech update / debt
Dominant language
Python
Stars
191
Forks
307
Avg merge
5d 6h
Merged PRs (30d)
10

Description

Sentry Issue: STUDIO-E92

IntegrityError: duplicate key value violates unique constraint "contentcuration_user_email_key"
DETAIL:  Key (email)=(batarazaseniorhigh@gmail.com) already exists.

  File "django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "newrelic/hooks/database_psycopg2.py", line 51, in execute
    **kwargs)
  File "newrelic/hooks/database_dbapi2.py", line 25, in execute
    *args, **kwargs)
  File "django_prometheus/db/common.py", line 68, in execute
    return super(CursorWrapper, self).execute(*args, **kwargs)

IntegrityError: duplicate key value violates unique constraint "contentcuration_user_email_key"
DETAIL:  Key (email)=(batarazaseniorhigh@gmail.com) already exists.

(24 additional frame(s) were not displayed)
...
  File "django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "newrelic/hooks/database_psycopg2.py", line 51, in execute
    **kwargs)
  File "newrelic/hooks/database_dbapi2.py", line 25, in execute
    *args, **kwargs)
  File "django_prometheus/db/common.py", line 68, in execute
    return super(CursorWrapper, self).execute(*args, **kwargs)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Sentry issue and the database call shown in django/db/backends/utils.py, then trace the project’s user creation or update path for the unique email constraint. Confirm how duplicate emails reach the database and add regression coverage; done means the scenario no longer raises this IntegrityError while email uniqueness remains enforced.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, postgresql, python
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.