Error message reference
For more information about how to work with exceptions and error codes, see Handling exceptions and errors.
Prisma Client error types
Prisma Client throws different kinds of errors. The following lists the exception types, and their documented data fields:
PrismaClientKnownRequestError
Prisma Client throws a PrismaClientKnownRequestError exception if the query engine returns a known error related to the request - for example, a unique constraint violation.
| Property | Description |
|---|---|
code | A Prisma-specific error code. |
meta | Additional information about the error - for example, the field that caused the error: { target: [ 'email' ] } |
message | Error message associated with error code. |
clientVersion | Version of Prisma Client (for example, 2.19.0) |
PrismaClientUnknownRequestError
Prisma Client throws a PrismaClientUnknownRequestError exception if the query engine returns an error related to a request that does not have an error code.
| Property | Description |
|---|---|
message | Error message associated with error code. |
clientVersion | Version of Prisma Client (for example, 2.19.0) |
PrismaClientRustPanicError
Prisma Client throws a PrismaClientRustPanicError exception if the underlying engine crashes and exits with a non-zero exit code. In this case, Prisma Client or the whole Node process must be restarted.
| Property | Description |
|---|---|
message | Error message associated with error code. |
clientVersion | Version of Prisma Client (for example, 2.19.0) |
PrismaClientInitializationError
Prisma Client throws a PrismaClientInitializationError exception if something goes wrong when the query engine is started and the connection to the database is created. This happens either:
- When
prisma.$connect()is called OR - When the first query is executed
Errors that can occur include:
- The provided credentials for the database are invalid
- There is no database server running under the provided hostname and port
- The port that the query engine HTTP server wants to bind to is already taken
- A missing or inaccessible environment variable
- The query engine binary for the current platform could not be found (
generatorblock)
| Property | Description |
|---|---|
errorCode | A Prisma-specific error code. |
message | Error message associated with error code. |
clientVersion | Version of Prisma Client (for example, 2.19.0) |
PrismaClientValidationError
Prisma Client throws a PrismaClientValidationError exception if validation fails - for example:
- Missing field - for example, an empty
data: {}property when creating a new record - Incorrect field type provided (for example, setting a
Booleanfield to"Hello, I like cheese and gold!")
| Property | Description |
|---|---|
message | Error message. |
clientVersion | Version of Prisma Client (for example, 2.19.0) |
Error codes
Common
P1000
"Authentication failed against database server at {database_host}, the provided database credentials for {database_user} are not valid. Please make sure to provide valid database credentials for the database server at {database_host}."