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 (
useActionStatepending 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).
Was this page helpful?