npmprisma95% confidence\u2191 22

PrismaClientKnownRequestError: P2002 Unique constraint failed

Full error message
PrismaClientKnownRequestError: Invalid `prisma.user.create()` invocation: Unique constraint failed on the fields: (`email`)

The insert violates a unique index. 1. Use `upsert` instead of `create` if this is expected. 2. Catch P2002 and return a 409 Conflict to the client. 3. Check for race conditions — two requests creating the same row simultaneously.

API access

Get this solution programmatically \u2014 free, no authentication.

curl https://depscope.dev/api/error/7d76285599aeaa01f1009003bba7603231daf2e28318107c0eeb6f4a0761cbcf
hash \u00b7 7d76285599aeaa01f1009003bba7603231daf2e28318107c0eeb6f4a0761cbcf
PrismaClientKnownRequestError: P2002 Unique constraint faile… — DepScope fix | DepScope