Prisma Client error reference

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

Query Engine

ErrorExample message
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. "
P2023"Inconsistent column data: {message} "
P2024"Timed out fetching a new connection from the pool. Please consider reducing the number of requests or increasing the connection_limit parameter ( Current limit: {connection_limit}. "
P2025"Record to delete does not exist."

Migration Engine

ErrorExample message
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. "
P3005"The database schema for {database_name} is not empty. Read more about how to baseline an existing production database: "
P3006"Migration {migration_name} failed to apply cleanly to a temporary database."
P3007"Some of the requested preview features are not yet allowed in migration engine. Please remove them from your data model before using migrations."
P3008"The migration {migration_name} is already recorded as applied in the database. "
P3009"migrate found failed migrations in the target database, new migrations will not be applied. Read more about how to resolve migration issues in a production database: {details} "
P3010"The name of the migration is too long. It must not be longer than 200 characters (bytes). "
P3011"Migration {migration_name} cannot be rolled back because it was never applied to the database. "
P3012"Migration {migration_name} cannot be rolled back because it is not in a failed state. "
P3013"Datasource provider arrays are no longer supported in migrate. Please change your datasource to use a single provider. Read more at "
P3014"The datasource provider {provider} specified in your schema does not match the one specified in the migration_lock.toml. You will encounter errors when you try to apply migrations generated for a different provider. Please archive your current migration directory at a different location and start a new migration history with prisma migrate dev. "


ErrorExample message
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} "
P1012"{full_error} "
P1013"The provided database string is invalid. {details} "
P1014"The underlying {kind} for model {model} does not exist. "
P1015"Your Prisma schema is using features that are not supported for the version of the database. Database version: {database_version} Errors: {errors} "

Introspection Engine

ErrorExample message
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