# `NeonDbError: duplicate key value violates unique constraint "…"`

**Where it appears:** Terminal or Vercel runtime logs

**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.

## Message for your agent

```text
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).
```

**Prevention:** Treat duplicate entries as expected errors returned via `useActionState`, never unhandled crashes.

---
Source: [Agentic Makers](https://agenticmakers.app/en/help/errors/postgres-duplicate-key-value-violates-unique-constraint) · License: CC BY 4.0
