Skip to main content

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.

PropertyDescription
codeA Prisma-specific error code.
metaAdditional information about the error - for example, the field that caused the error: { target: [ 'email' ] }
messageError message associated with error code.
clientVersionVersion 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.

PropertyDescription
messageError message associated with error code.
clientVersionVersion 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.

PropertyDescription
messageError message associated with error code.
clientVersionVersion 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 (generator block)
PropertyDescription
errorCodeA Prisma-specific error code.
messageError message associated with error code.
clientVersionVersion 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 Boolean field to "Hello, I like cheese and gold!")
PropertyDescription
messageError message.
clientVersionVersion 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}."

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

Note: If you get error code P1012 after you upgrade Prisma ORM to version 4.0.0 or later, see the version 4.0.0 upgrade guide. A schema that was valid before version 4.0.0 might be invalid in version 4.0.0 and later. The upgrade guide explains how to update your schema to make it valid.

"{full_error}"

Possible P1012 error messages:

  • "Argument {} is missing."
  • "Function {} takes arguments, but received ."
  • "Argument {} is missing in attribute @{}."
  • "Argument {} is missing in data source block {}."
  • "Argument {} is missing in generator block {}."
  • "Error parsing attribute @{}: "
  • "Attribute @{} is defined twice."
  • "The model with database name {} could not be defined because another model with this name exists: {}"
  • "{} is a reserved scalar type name and can not be used."
  • "The {} cannot be defined because a with that name already exists."
  • "Key {} is already defined in ."
  • "Argument {} is already specified as unnamed argument."
  • "Argument {} is already specified."
  • "No such argument.""
  • "Field {} is already defined on model {}."
  • "Field {} in model {} can't be a list. The current connector does not support lists of primitive types."
  • "The index name {} is declared multiple times. With the current connector index names have to be globally unique."
  • "Value {} is already defined on enum {}."
  • "Attribute not known: @{}."
  • "Function not known: {}."
  • "Datasource provider not known: {}."
  • "shadowDatabaseUrl is the same as url for datasource {}. Please specify a different database as shadow database."
  • "The preview feature {} is not known. Expected one of: "
  • "{} is not a valid value for ."
  • "Type {} is neither a built-in type, nor refers to another model, custom type, or enum."
  • "Type {} is not a built-in type."
  • "Unexpected token. Expected one of: "
  • "Environment variable not found: ."
  • "Expected a value, but received value {}."
  • "Expected a value, but failed while parsing {}: ."
  • "Error validating model {}: "
  • "Error validating field {} in model {}: "
  • "Error validating datasource {datasource}: {message}"
  • "Error validating enum {}: "
  • "Error validating: "

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}"

P1016

"Your raw query had an incorrect number of parameters. Expected: {expected}, actual: {actual}."

P1017

"Server has closed the connection."

Prisma Client (Query Engine)

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 connection pool. (More info: http://pris.ly/d/connection-pool (Current connection pool timeout: {timeout}, connection limit: {connection_limit})"

P2025

"An operation failed because it depends on one or more records that were required but not found. {cause}"

P2026

"The current database provider doesn't support a feature that the query used: {feature}"

P2027

"Multiple errors occurred on the database during query execution: {errors}"

P2028

"Transaction API error: {error}"

P2029

"Query parameter limit exceeded error: {message}"

P2030

"Cannot find a fulltext index to use for the search, try adding a @@fulltext([Fields...]) to your schema"

P2031

"Prisma needs to perform transactions, which requires your MongoDB server to be run as a replica set. See details: https://pris.ly/d/mongodb-replica-set"

P2033

"A number used in the query does not fit into a 64 bit signed integer. Consider using BigInt as field type if you're trying to store large integers"

P2034

"Transaction failed due to a write conflict or a deadlock. Please retry your transaction"

P2035

"Assertion violation on the database: {database_error}"

P2036

"Error in external connector (id {id})"

P2037

"Too many database connections opened: {message}"

Prisma Migrate (Schema Engine)

warning

The Schema Engine was previously called Migration Engine. This change was introduced in version 5.0.0.

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: https://pris.ly/d/migrate"

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 is not empty. Read more about how to baseline an existing production database: https://pris.ly/d/migrate-baseline"

P3006

"Migration {migration_name} failed to apply cleanly to the shadow database.
{error_code}Error:
{inner_error}"

P3007

"Some of the requested preview features are not yet allowed in schema engine. Please remove them from your data model before using migrations. (blocked: {list_of_blocked_features})"

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: https://pris.ly/d/migrate-resolve
{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. Hint: did you pass in the whole migration name? (example: "20201207184859_initial_migration")"

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 https://pris.ly/multi-provider-deprecation"

P3014

"Prisma Migrate could not create the shadow database. Please make sure the database user has permission to create databases. Read more about the shadow database (and workarounds) at https://pris.ly/d/migrate-shadow.

Original error: {error_code}
{inner_error}"

P3015

"Could not find the migration file at {migration_file_path}. Please delete the directory or restore the migration file."

P3016

"The fallback method for database resets failed, meaning Migrate could not clean up the database entirely. Original error: {error_code}
{inner_error}"

P3017

"The migration {migration_name} could not be found. Please make sure that the migration exists, and that you included the whole name of the directory. (example: "20201207184859_initial_migration")"

P3018

"A migration failed to apply. New migrations cannot be applied before the error is recovered from. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve

Migration name: {migration_name}

Database error code: {database_error_code}

Database error:
{database_error} "

P3019

"The datasource provider {provider} specified in your schema does not match the one specified in the migration_lock.toml, {expected_provider}. Please remove your current migration directory and start a new migration history with prisma migrate dev. Read more: https://pris.ly/d/migrate-provider-switch"

P3020

"The automatic creation of shadow databases is disabled on Azure SQL. Please set up a shadow database using the shadowDatabaseUrl datasource attribute.
Read the docs page for more details: https://pris.ly/d/migrate-shadow"

P3021

"Foreign keys cannot be created on this database. Learn more how to handle this: https://pris.ly/d/migrate-no-foreign-keys"

P3022

"Direct execution of DDL (Data Definition Language) SQL statements is disabled on this database. Please read more here about how to handle this: https://pris.ly/d/migrate-no-direct-ddl"

prisma db pull

P4000

"Introspection operation failed to produce a schema file: {introspection_error}"

P4001

"The introspected database was empty."

P4002

"The schema of the introspected database was inconsistent: {explanation}"

Prisma Accelerate

Prisma Accelerate-related errors start with P6xxx except for P5011.

P6000 (ServerError)

Generic error to catch all other errors.

P6001 (InvalidDataSource)

The URL is malformed; for instance, it does not use the prisma:// protocol.

P6002 (Unauthorized)

The API Key in the connection string is invalid.

P6003 (PlanLimitReached)

The included usage of the current plan has been exceeded. This can only occur on the free plan.

P6004 (QueryTimeout)

The global timeout of Accelerate has been exceeded. You can find the limit here.

Also see the troubleshooting guide for more information.

P6005 (InvalidParameters)

The user supplied invalid parameters. Currently only relevant for transaction methods. For example, setting a timeout that is too high. You can find the limit here.

P6006 (VersionNotSupported)

The chosen Prisma version is not compatible with Accelerate. This may occur when a user uses an unstable development version that we occasionally prune.

P6008 (ConnectionError|EngineStartError)

The engine failed to start. For example, it couldn't establish a connection to the database.

Also see the troubleshooting guide for more information.

P6009 (ResponseSizeLimitExceeded)

The global response size limit of Accelerate has been exceeded. You can find the limit here.

Also see the troubleshooting guide for more information.

P6010 (ProjectDisabledError)

Your accelerate project is disabled. Please enable it again to use it.

P5011 (Too Many Requests)

This error indicates that the request volume exceeded. Implement a back-off strategy and try again later. For assistance with expected high workloads, contact support.

Prisma Pulse

Prisma Pulse-related errors start with P61xx.

P6100 (ServerError) – HTTP Status 500

An unexpected server error occurred. This can happen due to a technical issue within the Prisma Pulse or its infrastructure. For any incidents related to Prisma Pulse, you can refer to our status page here and reach out to our support team through one of our available channels to report your issue.

P6101 (DatasourceError) – HTTP Status 400

Reasons:

  1. The datasource is not reachable by Prisma Pulse. The Console will validate the connection when enabling Pulse to reduce the likelihood of this error. However, the datasource may become unavailable after the configuration step, resulting in this error.
  2. The datasource is reachable, but did not meet the requirements for Prisma Pulse. The Console will validate the configuration when enabling Pulse to reduce the likelihood of this error. However, the datasource may change after the configuration step, resulting in this error.

P6102 (Unauthorized) – HTTP Status 400

The API key is invalid.

P6103 (ProjectDisabledError) – HTTP Status 400

Prisma Pulse is not enabled for the configured API key.

P6104 (AccountHoldError) – HTTP Status 400

Your Prisma Data Platform account has been blocked, potentially due to exceeding the usage limit included in your current plan. Please review the error message for further information.

If you require further assistance, please get in touch with us via one of our support channels.

P6105 (VersionNotSupported) – HTTP Status 400

The Prisma version of the project is not compatible with Prisma Pulse.