# X_DB_UNIQUE_VIOLATION

## Means

a unique constraint rejected the row

## Typical cause

SQLSTATE `23505` — two clicks racing a signup, or an insert where an upsert was meant. One of six driver failures that used to reach the caller as `X_DB_UNAVAILABLE`, whose fix reads "set `DATABASE_URL` to a reachable Postgres": a raced signup paged on-call for an outage that never happened. `meta.constraint` names the index the server refused on

## Fix

`upsertAll(rows, { onConflict: [...] })` over the columns the constraint `cause` names — or catch `X_DB_UNIQUE_VIOLATION` and answer 409, which is what a raced signup is

[Entity and database](/error-codes#entity-and-database)
