Error map

Foreign key constraint is incorrectly formed Laravel migration: SQLSTATE[HY000]: General error: 1005 Can't create table (errno: 150 "Foreign key constraint is incorrectly formed")

Laravel · layer 4, Application & API

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.

Foreign key constraint is incorrectly formed — Laravel migration: SQLSTATE[HY000]: General error: 1005 Can't create table (errno: 150 "Foreign key constraint is incorrectly formed") (Laravel)Foreign key…1146 — MySQL ERROR 1146 (42S02): Table 'db.table' doesn't exist (MySQL)11461060 — MySQL ERROR 1060 (42S21): Duplicate column name 'x' (MySQL)10601061 — MySQL ERROR 1061 (42000): Duplicate key name 'x' (MySQL)10611051 — MySQL ERROR 1051 (42S02): Unknown table 'x' (MySQL)10511091 — MySQL ERROR 1091 (42000): Can't DROP 'x'; check that column/key exists (MySQL)1091Laravel table not found — Laravel: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db.sessions' doesn't exist (PHP)Laravel table not f…1022 — MySQL ERROR 1022 (23000): Can't write; duplicate key in table (MySQL)1022SQLSTATE[23000]: Integrity constraint violation — Laravel: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'x@example.com' for key 'users_email_unique' (Laravel)SQLSTATE[23000]: In…SQLSTATE[42S22]: Column not found — Laravel: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'status' in 'field list' (Laravel)SQLSTATE[42S22]: Co…Base table or view already exists — Laravel: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists (Laravel)Base table or view …Specified key was too long; max key length is 1000 bytes — Laravel: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (Laravel)Specified key was t…Laravel: Allowed memory size exhausted (request) — Laravel/PHP: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in vendor/laravel/framework (Laravel)Laravel: Allowed me…1044 — MySQL ERROR 1044 (42000): Access denied for user to database (MySQL)10441064 — MySQL ERROR 1064 (42000): You have an error in your SQL syntax (MySQL)10641054 — MySQL ERROR 1054 (42S22): Unknown column in 'field list' (MySQL)105442P01 — PostgreSQL: ERROR: relation "x" does not exist (PostgreSQL)42P011007 — 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)10081071 — MySQL ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes (MySQL)1071Room cannot verify the data integrity — Room cannot verify the data integrity. Looks like you've changed schema but forgot to update the version number (Android)Room cannot verify …Unable 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 …1005 — MySQL ERROR 1005 (HY000): Can't create table (errno: 150 "Foreign key constraint is incorrectly formed") (MySQL)10051067 — MySQL ERROR 1067 (42000): Invalid default value for 'created_at' (MySQL)10671075 — MySQL ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key (MySQL)107542P07 — ERROR: relation "x" already exists (PostgreSQL)42P0742701 — ERROR: column "x" of relation "y" already exists (PostgreSQL)427012BP01 — ERROR: cannot drop table x because other objects depend on it (PostgreSQL)2BP01No 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…1062 — MySQL ERROR 1062 (23000): Duplicate entry for key (MySQL)10621452 — MySQL ERROR 1452: Cannot add or update a child row: a foreign key constraint fails (MySQL)1452Hibernate ConstraintViolationException — org.hibernate.exception.ConstraintViolationException: could not execute statement (Java)Hibernate Constrain…1048 — MySQL ERROR 1048 (23000): Column 'x' cannot be null (MySQL)10481451 — MySQL ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (MySQL)1451One or more database tables are unavailable — WordPress: One or more database tables are unavailable. The database may need to be repaired. (WordPress)One or more databas…SQLSTATE[HY000] [1045] Access denied for user — Laravel: SQLSTATE[HY000] [1045] Access denied for user 'forge'@'localhost' (using password: YES) (Laravel)SQLSTATE[HY000] [10…SQLSTATE[HY000] [2002] Connection refused — Laravel: SQLSTATE[HY000] [2002] Connection refused (SQL: select * from sessions) / php_network_getaddresses: getaddrinfo failed (Laravel)SQLSTATE[HY000] [20…PDOException: could not find driver — Laravel: Illuminate\Database\QueryException: could not find driver (SQL: select * from information_schema.tables) (Laravel)PDOException: could…Attempt to read property "x" on null — Laravel/PHP 8: ErrorException: Attempt to read property "name" on null (Laravel)Attempt to read pro…Command "x" is not defined — Laravel: Symfony\Component\Console\Exception\CommandNotFoundException: Command "make:livewire" is not defined. Did you mean one of these? (Laravel)Command "x" is not …SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client — Laravel: SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client [caching_sha2_password] (Laravel)SQLSTATE[HY000] [20…Allowed memory size exhausted — PHP Fatal error: Allowed memory size of X bytes exhausted (PHP)Allowed memory size…SIGSEGV — Segmentation fault (core dumped) (Linux)SIGSEGVOOM killer — Killed / Out of memory: Killed process (Linux OOM killer) (Linux)OOM killer

Directly related (12)

1146MySQL

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

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

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.

1061MySQL

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

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

1051MySQL

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

DROP TABLE targeted a table that doesn’t exist.

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.

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.

1022MySQL

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

An ALTER/CREATE produced a duplicate key or constraint name — often a foreign key name that already exists in the database.

SQLSTATE[23000]: Integrity constraint violationLaravel

Laravel: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'x@example.com' for key 'users_email_unique'

The query violated a database constraint — a duplicate value in a unique column or a missing/blocked foreign key.

SQLSTATE[42S22]: Column not foundLaravel

Laravel: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'status' in 'field list'

The SQL refers to a column that doesn't exist in the table — a missing migration, typo or wrong table.

Base table or view already existsLaravel

Laravel: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists

A migration tries to create a table that is already in the database.

Specified key was too long; max key length is 1000 bytesLaravel

Laravel: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

An indexed string column exceeds the index size allowed by an older MySQL/MariaDB with utf8mb4.

Laravel: Allowed memory size exhausted (request)Laravel

Laravel/PHP: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in vendor/laravel/framework

A request (or artisan job) used more memory than PHP's `memory_limit` allows.

Two steps away (33)

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.

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).

42P01PostgreSQL

PostgreSQL: ERROR: relation "x" does not exist

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

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.

1071MySQL

MySQL ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes

An index on a VARCHAR is too long for the row format — classic with utf8mb4 VARCHAR(255) on MySQL 5.6/MariaDB 10.1.

Room cannot verify the data integrityAndroid

Room cannot verify the data integrity. Looks like you've changed schema but forgot to update the version number

The Room entity definitions changed, but the database version wasn’t increased or no migration was provided.

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.

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.

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.

1075MySQL

MySQL ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key

An AUTO_INCREMENT column isn’t indexed (or there are two auto-increment columns).

42P07PostgreSQL

ERROR: relation "x" already exists

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

42701PostgreSQL

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

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

2BP01PostgreSQL

ERROR: cannot drop table x because other objects depend on it

Views, foreign keys or other objects depend on what you’re dropping.

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.

1062MySQL

MySQL ERROR 1062 (23000): Duplicate entry for key

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

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.

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).

1048MySQL

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

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

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.

One or more database tables are unavailableWordPress

WordPress: One or more database tables are unavailable. The database may need to be repaired.

WordPress can’t read one or more of its tables — they’re crashed (MyISAM), missing, or the table prefix in wp-config.php is wrong.

SQLSTATE[HY000] [1045] Access denied for userLaravel

Laravel: SQLSTATE[HY000] [1045] Access denied for user 'forge'@'localhost' (using password: YES)

MySQL rejected the username/password configured in Laravel's `.env`.

SQLSTATE[HY000] [2002] Connection refusedLaravel

Laravel: SQLSTATE[HY000] [2002] Connection refused (SQL: select * from sessions) / php_network_getaddresses: getaddrinfo failed

Laravel can't open a network connection to the database host and port from `.env`.

PDOException: could not find driverLaravel

Laravel: Illuminate\Database\QueryException: could not find driver (SQL: select * from information_schema.tables)

The PHP PDO extension for your database (pdo_mysql, pdo_pgsql, pdo_sqlite) isn't installed or enabled.

Attempt to read property "x" on nullLaravel

Laravel/PHP 8: ErrorException: Attempt to read property "name" on null

You accessed a property on a value that is `null`, typically an empty relationship or a query that found nothing.

Command "x" is not definedLaravel

Laravel: Symfony\Component\Console\Exception\CommandNotFoundException: Command "make:livewire" is not defined. Did you mean one of these?

`php artisan` doesn't know the command you typed — typo, missing package or an unregistered service provider.

SQLSTATE[HY000] [2054] The server requested authentication method unknown to the clientLaravel

Laravel: SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client [caching_sha2_password]

The PHP MySQL driver doesn't support the authentication plugin MySQL 8 uses (`caching_sha2_password`).

Allowed memory size exhaustedPHP

PHP Fatal error: Allowed memory size of X bytes exhausted

The script tried to use more memory than PHP’s `memory_limit` allows.

SIGSEGVLinux

Segmentation fault (core dumped)

A program accessed memory it wasn’t allowed to, and the kernel killed it with SIGSEGV (exit code 139).

OOM killerLinux

Killed / Out of memory: Killed process (Linux OOM killer)

The kernel ran out of memory and killed a process to recover — the program just prints “Killed” (exit code 137).