Terminal or Vercel runtime logs

NeonDbError: duplicate key value violates unique constraint "…"

What it means
The app tried to save a record (such as an email, username or slug) that already exists in a column where every row must be unique.
Likely causes
  • A visitor submitted a form with an email or slug that is already taken, and the Server Action didn't turn that into a friendly message.
  • A submit button wasn't disabled while saving (useActionState pending state), so a double-click sent the same form twice.
Prevention
Treat duplicate entries as expected errors returned via useActionState, never unhandled crashes.

Copy for your agent

Saving failed with `duplicate key value violates unique constraint`. Handle this as an expected error in the Server Action and return a friendly message (plus disable the submit button while pending).

Full help articleThe app can't connect to the database

Last reviewed Nov 8, 2026