prisma
Prisma Error Codes
Error codes emitted by the Prisma ORM, covering database connection failures, query engine errors, migration problems, and Data Proxy issues. Codes are prefixed P followed by four digits.
42 codes
· All codes 42 codes
- P1000 Authentication failed against database server Authentication failed against the database server. The provided database credentials are not valid. Verify the username and password in your datasource URL.
- P1001 Can't reach database server Prisma cannot reach the database server at the configured host and port. Check that the server is running, the connection string is correct, and no firewall is blocking the connection.
- P1002 Database server timed out The database server was reached but timed out before responding. Check that the host and port are correct and that the server is not overloaded.
- P1003 Database does not exist The database file, schema, or server does not exist at the configured path or URL. Create the database or correct the connection string.
- P1008 Operations timed out Database operations timed out after the configured timeout period. Increase the connection timeout or optimise the query.
- P1009 Database already exists Database already exists on the server. Use a different database name or drop the existing one before creating.
- P1010 Access denied to database The database user was denied access to the database. Grant the required privileges to the database user.
- P1011 Error opening TLS connection Error opening a TLS connection. Verify your TLS certificate configuration and that the database server supports the TLS version you have configured.
- P1012 Schema validation error The Prisma schema file contains a validation error. Check the field types, relations, and attribute syntax reported in the error message.
- P1013 Invalid database string The provided database connection string is not valid. Check the format, protocol, and parameters in the datasource URL.
- P1014 Underlying kind does not exist The underlying model, view, enum, or type does not exist in the database. It may have been deleted or renamed outside of Prisma Migrate.
- P1015 Unsupported database features used in schema Your Prisma schema uses features that are not supported for the version of the database in use. Check the database version and Prisma compatibility matrix.
- P1016 Raw query had incorrect number of parameters A raw query was called with the wrong number of parameters. Ensure the number of placeholder bindings matches the values supplied.
- P1017 Server has closed the connection The database server closed the connection unexpectedly. This may be caused by an idle timeout or a server-side disconnect. Retry the operation.
- P2000 Value too long for column type The provided value for a column is too long for the column's type. Truncate the value or increase the column size in the schema.
- P2001 Record not found The record searched for in the where condition does not exist. Verify the filter parameters match an existing record.
- P2002 Unique constraint failed A unique constraint violation occurred. A record with the given value already exists for the unique field. Use upsert or check for existing records before inserting.
- P2003 Foreign key constraint failed A foreign key constraint violation occurred. The referenced record does not exist in the related table. Ensure the related record exists before creating the referencing record.
- P2004 Constraint failed on the database A database-level constraint failed that is not modelled in the Prisma schema. Check the database for triggers, check constraints, or other constraints on the table.
- P2005 Invalid value stored in the database The value stored in the database for a field is invalid for the field's type in the Prisma schema. This may indicate a schema mismatch or data corruption.
- P2006 Provided value not valid for field type The provided value for a Prisma model field is not valid. Verify the type and format of the value matches the field definition.
- P2007 Data validation error A data validation error occurred. The data does not conform to the expected type or constraints defined in the schema.
- P2010 Raw query failed A raw database query failed. Check the SQL syntax, parameter bindings, and that the target table and columns exist.
- P2011 Null constraint violation A null constraint violation occurred. A non-nullable field received a null value. Provide a non-null value or make the field optional in the schema.
- P2012 Missing a required value A required value was not provided in the query. All required fields must be supplied.
- P2013 Missing required argument A required argument for a field on a directive was missing. Check that all required arguments are provided in the query.
- P2014 Required relation violation The change would violate the required relation between two models. Disconnect or delete the related record before making this change.
- P2015 Related record not found A related record could not be found. The record referenced in a nested query does not exist.
- P2020 Value out of range for type The provided value is out of range for the field's type. Use a value within the valid range for the column type.
- P2021 Table does not exist in the database The table does not exist in the current database. Run `prisma migrate dev` or `prisma db push` to synchronise the database with your schema.
- P2022 Column does not exist in the database The column does not exist in the current database. Run `prisma migrate dev` or `prisma db push` to synchronise the database schema.
- P2024 Timed out fetching connection from pool Timed out fetching a new connection from the connection pool. Increase the connection pool size or the connection timeout, or reduce query concurrency.
- P2025 Required record not found An operation failed because a required record was not found. This commonly occurs with findUniqueOrThrow, updateOrThrow, or nested operations that depend on a related record existing.
- P2026 Unsupported feature The current database provider does not support a feature used in the query. Check the Prisma documentation for provider-specific limitations.
- P2028 Transaction API error A transaction API error occurred. The transaction may have timed out or conflicted with another transaction. Retry with exponential backoff.
- P2034 Transaction failed due to write conflict or deadlock The transaction failed due to a write conflict or deadlock. Retry the transaction; for MongoDB, this occurs when the replica set is under high write load.
- P3000 Failed to create database Failed to create the database. Ensure the database user has sufficient privileges to create databases.
- P3001 Migration contains destructive changes The migration contains destructive changes that would result in data loss. Use --force to apply anyway, or modify the migration to preserve data.
- P3005 Database schema is not empty The database schema is not empty. Prisma Migrate requires an empty schema or an existing migration history to initialise safely.
- P3006 Migration failed to apply to shadow database A migration failed to apply cleanly to the shadow database. This often indicates a bug in the migration SQL or an environmental difference between development and shadow databases.
- P3009 Failed migrations in the target database Prisma Migrate found failed migrations in the target database. Resolve the failed migrations before running new ones.
- P4001 Introspected database is empty The introspected database contains no tables or collections. Connect a database with existing data to generate a Prisma schema using introspection.