#36 most commondatabaseLovableBolt.newCursorReplitv0Windsurf
duplicate key value violates unique constraint
duplicate key value violates unique constraint "profiles_pkey" (23505)
Got a slightly different error? Paste the exact message and get a fix prompt tailored to it.
Paste your error →What it means
You tried to save something that must be unique (like a user's profile or an email) but it's already there. Often the app creates the same profile twice.
How to fix it: paste this prompt into your AI builder
Fix prompt for Lovable, Bolt, Cursor, Replit, v0, Windsurf
Supabase returns "duplicate key value violates unique constraint". Find the insert causing it. If the record may already exist, use upsert with the correct onConflict column, or check before inserting. If a profile is also created by a database trigger on signup, remove the duplicate insert from the frontend. Don't drop the constraint or change unrelated code.
If the AI can't fix it: manual steps
- Check Supabase Database, Triggers for an existing on_auth_user_created trigger that already creates profiles.
Where this happens
Seen in these AI app builders and editors:
LovableBolt.newCursorReplitv0Windsurf
Sources
Related database errors
Still stuck? Paste your full error and UnstuckMyVibe will match it and hand you the exact fix prompt.
Fix my error →