# X_DB_SERIALIZATION_FAILURE

## Means

the transaction lost a serialization race

## Typical cause

SQLSTATE `40001` or `40P01` — a serializable transaction whose read set another commit invalidated, or a deadlock the server broke. Retryable by definition, which is why it is its own code and not an outage

## Fix

`withTransaction(fn, { retry: 3 })` — `fn` re-runs from the top, so it must be idempotent

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