This page describes Prisma Client exceptions and error codes.


Prisma Client throws a PrismaClientKnownRequestError exception if the query engine returns a known error related to the request - for example, a unique constraint violation.

codeA Prisma-specific error code.
metaAdditional information about the error - for example, the field that caused the error: { target: [ 'email' ] }

Error codes

// Generated with

Query Engine

ErrorExample messageDescription
P2000"The provided value for the column is too long for the column's type. Column: ${column_name}"
P2001"The record searched for in the where condition (${model_name}.${argument_name} = ${argument_value}) does not exist"
P2002"Unique constraint failed on the ${constraint}"
P2003"Foreign key constraint failed on the field: ${field_name}"
P2004"A constraint failed on the database: ${database_error}"
P2005"The value ${field_value} stored in the database for the field ${field_name} is invalid for the field's type"
P2006"The provided value ${field_value} for ${model_name} field ${field_name} is not valid"
P2007"Data validation error ${database_error}"
P2008"Failed to parse the query ${query_parsing_error} at ${query_position}"
P2009"Failed to validate the query ${query_validation_error} at ${query_position}"
P2010"Raw query failed. Code: ${code}. Message: ${message}"
P2011"Null constraint violation on the ${constraint}"
P2012"Missing a required value at ${path}"
P2013"Missing the required argument ${argument_name} for field ${field_name} on ${object_name}."
P2014"The change you are trying to make would violate the required relation '${relation_name}' between the ${model_a_name} and ${model_b_name} models."
P2015"A related record could not be found. ${details}"
P2016"Query interpretation error. ${details}"
P2017"The records for relation ${relation_name} between the ${parent_name} and ${child_name} models are not connected."
P2018"The required connected records were not found. ${details}"
P2019"Input error. ${details}"
P2020"Value out of range for the type. ${details}"
P2021"The table ${table} does not exist in the current database."
P2022"The column ${column} does not exist in the current database."

Migration Engine

ErrorExample messageDescription
P3000"Failed to create database: ${database_error}"
P3001"Migration possible with destructive changes and possible data loss: ${migration_engine_destructive_details}"
P3002"The attempted migration was rolled back: ${database_error}"
P3003"The format of migrations changed, the saved migrations are no longer valid. To solve this problem, please follow the steps at:"
P3004"The ${database_name} database is a system database, it should not be altered with prisma migrate. Please connect to another database."


ErrorExample messageDescription
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}."
P1001"Can't reach database server at ${database_host}:${database_port} Please make sure your database server is running at ${database_host}:${database_port}."
P1002"The database server at ${database_host}:${database_port} was reached but timed out. Please try again. Please make sure your database server is running at ${database_host}:${database_port}. "
P1003"Database ${database_file_name} does not exist at ${database_file_path}"
"Database ${database_name}.${database_schema_name} does not exist on the database server at ${database_host}:${database_port}."
"Database ${database_name} does not exist on the database server at ${database_host}:${database_port}."
P1008"Operations timed out after ${time}"
P1009"Database ${database_name} already exists on the database server at ${database_host}:${database_port}"
P1010"User ${database_user} was denied access on the database ${database_name}"
P1011"Error opening a TLS connection: ${message}"
P1013"The provided database string is invalid. ${details}"
P1014"The underlying ${kind} for model ${model} does not exist."

Introspection Engine

ErrorExample messageDescription
P4000"Introspection operation failed to produce a schema file: ${introspection_error}"
P4001"The introspected database was empty: ${connection_string}"
P4002"The schema of the introspected database was inconsistent: ${explanation}"


Prisma Client throws a PrismaClientUnknownRequestError exception if the query engine returns an error related to a request that does not have an error code.


Prisma Client throws a PrismaClientRustPanicError exception if the underlying engine crashes and exits with a non-zero exit code. In this case, the Prisma Client or the whole Node process must be restarted.


Prisma Client throws a PrismaClientInitializationError exception if something goes wrong when the query engine binary is started. This happens either:

  • When prisma.$connect() is called OR
  • After the first query

Errors that can occur include:

  • 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 (generator block)


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 Boolean field to "Hello, I like cheese and gold!")
Edit this page on Github