Error map

1022 MySQL ERROR 1022 (23000): Can't write; duplicate key in table

MySQL · layer 5, Data

Open the full error page →

Centre: this error. First ring: errors it is linked with (12). Outer ring: what those are linked with. Colours show the layer of a request each error belongs to. Click any dot to re-centre the map on it; hover to follow its connections. The centre dot opens the error page.

1022 — MySQL ERROR 1022 (23000): Can't write; duplicate key in table (MySQL)1022ActiveRecord::PendingMigrationError — Rails: ActiveRecord::PendingMigrationError — Migrations are pending. To resolve this issue, run: bin/rails db:migrate (Ruby / Rails)ActiveRecord::Pendi…1062 — MySQL ERROR 1062 (23000): Duplicate entry for key (MySQL)10621418 — MySQL ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (MySQL)1418DbUpdateException — DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. (.NET)DbUpdateExceptionUnable to create a 'DbContext' — dotnet ef: Unable to create a 'DbContext' of type ''. The exception 'Unable to resolve service for type DbContextOptions' was thrown while attempting to create an instance (.NET)Unable to create a …1452 — MySQL ERROR 1452: Cannot add or update a child row: a foreign key constraint fails (MySQL)1452Laravel table not found — Laravel: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db.sessions' doesn't exist (PHP)Laravel table not f…1146 — MySQL ERROR 1146 (42S02): Table 'db.table' doesn't exist (MySQL)1146Django no such table — django.db.utils.OperationalError: no such table: app_model (Python)Django no such tableALREADY_EXISTS — API Error: Resource already exists (ALREADY_EXISTS / resource_already_exists / 409) (API)ALREADY_EXISTSHibernate ConstraintViolationException — org.hibernate.exception.ConstraintViolationException: could not execute statement (Java)Hibernate Constrain…1060 — MySQL ERROR 1060 (42S21): Duplicate column name 'x' (MySQL)106042P01 — PostgreSQL: ERROR: relation "x" does not exist (PostgreSQL)42P011051 — MySQL ERROR 1051 (42S02): Unknown table 'x' (MySQL)10511061 — MySQL ERROR 1061 (42000): Duplicate key name 'x' (MySQL)1061Deadlock — Deadlock found when trying to get lock; try restarting transaction (SQL)Deadlock409 — HTTP 409 Conflict (HTTP)409Subquery returns more than 1 row — Subquery returns more than 1 row (MySQL 1242) / more than one row returned by a subquery used as an expression (SQL)Subquery returns mo…1045 — MySQL ERROR 1045 (28000): Access denied for user (MySQL)10451044 — MySQL ERROR 1044 (42000): Access denied for user to database (MySQL)10441040 — MySQL ERROR 1040 (08004): Too many connections (MySQL)1040JsonException object cycle — JsonException: A possible object cycle was detected (.NET)JsonException objec…23505 — PostgreSQL: ERROR: duplicate key value violates unique constraint (PostgreSQL)235051048 — MySQL ERROR 1048 (23000): Column 'x' cannot be null (MySQL)1048InvalidOperationException — InvalidOperationException: Unable to resolve service for type 'X' while attempting to activate 'Y' (.NET)InvalidOperationExc…1091 — MySQL ERROR 1091 (42000): Can't DROP 'x'; check that column/key exists (MySQL)109142P07 — ERROR: relation "x" already exists (PostgreSQL)42P071005 — MySQL ERROR 1005 (HY000): Can't create table (errno: 150 "Foreign key constraint is incorrectly formed") (MySQL)10051215 — MySQL ERROR 1215 (HY000): Cannot add foreign key constraint (MySQL)12151451 — MySQL ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (MySQL)1451No application encryption key — Laravel: No application encryption key has been specified. (PHP)No application encr…419 Page Expired — Laravel: 419 Page Expired (CSRF token mismatch) (PHP)419 Page ExpiredTarget class does not exist — Laravel: Target class [App\Http\Controllers\X] does not exist. (PHP)Target class does n…1064 — MySQL ERROR 1064 (42000): You have an error in your SQL syntax (MySQL)10641054 — MySQL ERROR 1054 (42S22): Unknown column in 'field list' (MySQL)105442701 — ERROR: column "x" of relation "y" already exists (PostgreSQL)42701ImproperlyConfigured — django.core.exceptions.ImproperlyConfigured: settings are not configured / SECRET_KEY must not be empty (Python)ImproperlyConfiguredDisallowedHost — django.core.exceptions.DisallowedHost: Invalid HTTP_HOST header: 'x'. You may need to add 'x' to ALLOWED_HOSTS. (Python)DisallowedHostTemplateDoesNotExist — django.template.exceptions.TemplateDoesNotExist: app/page.html (Python)TemplateDoesNotExistE11000 duplicate key — MongoServerError: E11000 duplicate key error collection: db.users index: email_1 dup key (Node.js)E11000 duplicate keyPrisma P2002 — PrismaClientKnownRequestError P2002: Unique constraint failed on the fields: (`email`) (Node.js)Prisma P200223503 — ERROR: insert or update on table "x" violates foreign key constraint "fk" — Key (user_id)=(5) is not present in table "users" (PostgreSQL)23503LazyInitializationException — org.hibernate.LazyInitializationException: could not initialize proxy - no Session (Java)LazyInitializationE…TransientObjectException — org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing (Java)TransientObjectExce…NonUniqueResultException — IncorrectResultSizeDataAccessException: query did not return a unique result: 2 (Java)NonUniqueResultExce…1007 — MySQL ERROR 1007 (HY000): Can't create database 'x'; database exists (MySQL)10071008 — MySQL ERROR 1008 (HY000): Can't drop database 'x'; database doesn't exist (MySQL)10081067 — MySQL ERROR 1067 (42000): Invalid default value for 'created_at' (MySQL)1067

Directly related (12)

ActiveRecord::PendingMigrationErrorRuby / Rails

Rails: ActiveRecord::PendingMigrationError — Migrations are pending. To resolve this issue, run: bin/rails db:migrate

The database schema is behind the migration files in the app.

1062MySQL

MySQL ERROR 1062 (23000): Duplicate entry for key

An INSERT/UPDATE would create a duplicate value in a PRIMARY or UNIQUE key.

1418MySQL

MySQL ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled

Creating a stored function failed because binary logging requires it to declare its data access characteristics.

DbUpdateException.NET

DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details.

SaveChanges failed in the database; the inner exception (SqlException/PostgresException) has the real reason — constraint violati…

Unable to create a 'DbContext'.NET

dotnet ef: Unable to create a 'DbContext' of type ''. The exception 'Unable to resolve service for type DbContextOptions' was thrown while attempting to create an instance

dotnet ef migrations couldn’t construct your DbContext at design time.

1452MySQL

MySQL ERROR 1452: Cannot add or update a child row: a foreign key constraint fails

You inserted/updated a row whose foreign key value doesn’t exist in the referenced parent table.

Laravel table not foundPHP

Laravel: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db.sessions' doesn't exist

Laravel queried a table that hasn’t been created — usually sessions, cache, jobs or a new model’s table.

1146MySQL

MySQL ERROR 1146 (42S02): Table 'db.table' doesn't exist

The query references a table that MySQL can’t find in that database.

Django no such tablePython

django.db.utils.OperationalError: no such table: app_model

Django queried a table that hasn’t been created — migrations missing or not applied.

ALREADY_EXISTSAPI

API Error: Resource already exists (ALREADY_EXISTS / resource_already_exists / 409)

The create request was refused because an object with the same unique identity — name, email, external ID — already exists.

Hibernate ConstraintViolationExceptionJava

org.hibernate.exception.ConstraintViolationException: could not execute statement

The database rejected an insert/update because of a constraint (unique, foreign key, not null).

1060MySQL

MySQL ERROR 1060 (42S21): Duplicate column name 'x'

A CREATE/ALTER adds a column that already exists, or a SELECT in a view/derived table produces two columns with the same name.

Two steps away (36)

42P01PostgreSQL

PostgreSQL: ERROR: relation "x" does not exist

The table/view isn’t found — missing migration, wrong schema, or a case-sensitive quoted name.

1051MySQL

MySQL ERROR 1051 (42S02): Unknown table 'x'

DROP TABLE targeted a table that doesn’t exist.

1061MySQL

MySQL ERROR 1061 (42000): Duplicate key name 'x'

CREATE INDEX/ADD INDEX used an index name that already exists on the table.

DeadlockSQL

Deadlock found when trying to get lock; try restarting transaction

Two transactions waited on each other’s locks; the database killed one so the other could continue.

409HTTP

HTTP 409 Conflict

The request conflicts with the current state of the resource — e.g. a duplicate or an edit based on an outdated version.

Subquery returns more than 1 rowSQL

Subquery returns more than 1 row (MySQL 1242) / more than one row returned by a subquery used as an expression

A subquery used where a single value is expected (`= (SELECT …)`) returned several rows.

1045MySQL

MySQL ERROR 1045 (28000): Access denied for user

MySQL rejected the login — wrong password, wrong user/host combination, or the user doesn’t exist.

1044MySQL

MySQL ERROR 1044 (42000): Access denied for user to database

The login succeeded, but the user has no privileges on the database you’re using.

1040MySQL

MySQL ERROR 1040 (08004): Too many connections

MySQL reached `max_connections` and refuses new clients.

JsonException object cycle.NET

JsonException: A possible object cycle was detected

System.Text.Json found a reference loop (e.g. Order → Customer → Orders → …) while serialising, usually from EF Core navigation p…

23505PostgreSQL

PostgreSQL: ERROR: duplicate key value violates unique constraint

An INSERT/UPDATE would create a duplicate in a UNIQUE or PRIMARY KEY column — or the id sequence is behind the existing data.

1048MySQL

MySQL ERROR 1048 (23000): Column 'x' cannot be null

An INSERT/UPDATE put NULL into a NOT NULL column.

InvalidOperationException.NET

InvalidOperationException: Unable to resolve service for type 'X' while attempting to activate 'Y'

ASP.NET Core’s dependency injection container can’t build Y because one of its constructor dependencies (X) was never registered.

1091MySQL

MySQL ERROR 1091 (42000): Can't DROP 'x'; check that column/key exists

ALTER TABLE tried to drop a column or index that doesn’t exist.

42P07PostgreSQL

ERROR: relation "x" already exists

CREATE TABLE/INDEX/SEQUENCE used a name that already exists in that schema.

1005MySQL

MySQL ERROR 1005 (HY000): Can't create table (errno: 150 "Foreign key constraint is incorrectly formed")

A foreign key definition is invalid — the referenced column’s type, index or charset doesn’t match.

1215MySQL

MySQL ERROR 1215 (HY000): Cannot add foreign key constraint

The foreign key can’t be created — mismatched column types, missing index, or incompatible engines/collations.

1451MySQL

MySQL ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails

You tried to delete/update a row that other rows still reference.

No application encryption keyPHP

Laravel: No application encryption key has been specified.

Laravel’s APP_KEY is missing, so it can’t encrypt sessions and cookies.

419 Page ExpiredPHP

Laravel: 419 Page Expired (CSRF token mismatch)

Laravel rejected a POST because the CSRF token was missing, expired or didn’t match the session.

Target class does not existPHP

Laravel: Target class [App\Http\Controllers\X] does not exist.

Laravel’s container couldn’t find the controller or class named in a route or binding.

1064MySQL

MySQL ERROR 1064 (42000): You have an error in your SQL syntax

MySQL couldn’t parse the query. The text after “near” shows where parsing failed.

1054MySQL

MySQL ERROR 1054 (42S22): Unknown column in 'field list'

The query references a column that doesn’t exist in the table (or an unquoted string being read as a column).

42701PostgreSQL

ERROR: column "x" of relation "y" already exists

ALTER TABLE ADD COLUMN for a column that’s already there.

ImproperlyConfiguredPython

django.core.exceptions.ImproperlyConfigured: settings are not configured / SECRET_KEY must not be empty

Django can’t load its settings — DJANGO_SETTINGS_MODULE unset, a required setting missing, or an environment variable not provide…

DisallowedHostPython

django.core.exceptions.DisallowedHost: Invalid HTTP_HOST header: 'x'. You may need to add 'x' to ALLOWED_HOSTS.

The request’s Host header isn’t listed in Django’s ALLOWED_HOSTS.

TemplateDoesNotExistPython

django.template.exceptions.TemplateDoesNotExist: app/page.html

Django searched all template directories and couldn’t find that template.

E11000 duplicate keyNode.js

MongoServerError: E11000 duplicate key error collection: db.users index: email_1 dup key

An insert/update violated a unique index in MongoDB.

Prisma P2002Node.js

PrismaClientKnownRequestError P2002: Unique constraint failed on the fields: (`email`)

A Prisma create/update violated a unique constraint.

23503PostgreSQL

ERROR: insert or update on table "x" violates foreign key constraint "fk" — Key (user_id)=(5) is not present in table "users"

The row references a parent row that doesn’t exist.

LazyInitializationExceptionJava

org.hibernate.LazyInitializationException: could not initialize proxy - no Session

A lazy-loaded association was accessed after the Hibernate session/transaction closed.

TransientObjectExceptionJava

org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing

An entity references another entity that hasn’t been saved yet, and no cascade is configured.

NonUniqueResultExceptionJava

IncorrectResultSizeDataAccessException: query did not return a unique result: 2

A query expected one row but found several.

1007MySQL

MySQL ERROR 1007 (HY000): Can't create database 'x'; database exists

CREATE DATABASE ran for a database that already exists.

1008MySQL

MySQL ERROR 1008 (HY000): Can't drop database 'x'; database doesn't exist

DROP DATABASE targeted a database that isn’t there.

1067MySQL

MySQL ERROR 1067 (42000): Invalid default value for 'created_at'

A column’s DEFAULT isn’t allowed in the current SQL mode — classically '0000-00-00 00:00:00' with NO_ZERO_DATE.