The Prompt BakeryTemplates and prompts

Fix · Supabase and databases

duplicate key value violates unique constraint (23505)

What you may see

  • Saving fails because something with the same value already exists

Most likely cause

A column that must be unique (an email, a slug, an order number) already holds this value.

Check first (about two minutes)

  1. Read the constraint name in the message: it tells which column.

The fix prompt

What you type here never leaves your browser. The search runs on this page, and nothing is sent to a server or to an AI.

Kept only in this browser, on this device. Keys and passwords are removed before anything is saved.

Prompt language

Paste it into Claude, ChatGPT, Gemini or Cursor, then follow what it says.

After you tried it, did it work?

Steps

  1. Find which column and which existing row clash.
  2. Decide with me: update the existing row (upsert), choose another value, or show a friendly message.
  3. Make the code handle this error with a clear message.

Do not do this

  • Do not delete the old row without checking what depends on it.
  • Do not remove the unique rule.

Related

Try another entry

How can we help?

What do you need?
Your email, so we can reply (optional)Only enter your own email. We reply there.