Error map

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

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 c…ActiveRecord::PendingMigrationError — Rails: ActiveRecord::PendingMigrationError — Migrations are pending. To resolve this issue, run: bin/rails db:migrate (Ruby / Rails)ActiveRecord::Pendi…InvalidOperationException — InvalidOperationException: Unable to resolve service for type 'X' while attempting to activate 'Y' (.NET)InvalidOperationExc…requires a primary key to be defined — EF Core: The entity type 'X' requires a primary key to be defined (.NET)requires a primary …DbUpdateException — DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. (.NET)DbUpdateExceptionCannot access a disposed context instance — ObjectDisposedException: Cannot access a disposed context instance (.NET)Cannot access a dis…42P01 — PostgreSQL: ERROR: relation "x" does not exist (PostgreSQL)42P011146 — MySQL ERROR 1146 (42S02): Table 'db.table' doesn't exist (MySQL)1146Laravel table not found — Laravel: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db.sessions' doesn't exist (PHP)Laravel table not f…42P07 — ERROR: relation "x" already exists (PostgreSQL)42P07Django no such table — django.db.utils.OperationalError: no such table: app_model (Python)Django no such table1060 — MySQL ERROR 1060 (42S21): Duplicate column name 'x' (MySQL)106042701 — ERROR: column "x" of relation "y" already exists (PostgreSQL)427011022 — MySQL ERROR 1022 (23000): Can't write; duplicate key in table (MySQL)10221051 — MySQL ERROR 1051 (42S02): Unknown table 'x' (MySQL)10511061 — MySQL ERROR 1061 (42000): Duplicate key name 'x' (MySQL)1061NullReferenceException — System.NullReferenceException: Object reference not set to an instance of an object (.NET)NullReferenceExcept…500.30 — HTTP Error 500.30 - ASP.NET Core app failed to start (.NET)500.30JsonException object cycle — JsonException: A possible object cycle was detected (.NET)JsonException objec…No database provider has been configured — InvalidOperationException: No database provider has been configured for this DbContext (.NET)No database provide…A second operation was started on this context — EF Core: A second operation was started on this context instance before a previous operation completed (.NET)A second operation …cannot be tracked because another instance with the same key — The instance of entity type 'X' cannot be tracked because another instance with the same key value for {'Id'} is already being tracked (.NET)cannot be tracked b…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)145223505 — PostgreSQL: ERROR: duplicate key value violates unique constraint (PostgreSQL)23505The LINQ expression could not be translated — EF Core: The LINQ expression 'x' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly (.NET)The LINQ expression…500.19 — HTTP Error 500.19 - Internal Server Error: The requested page cannot be accessed because the related configuration data for the page is invalid (.NET)500.19An unhandled error has occurred — Blazor: An unhandled error has occurred. Reload 🗙 (.NET)An unhandled error …28P01 — PostgreSQL: FATAL: password authentication failed for user (PostgreSQL)28P0142703 — PostgreSQL: ERROR: column "x" does not exist (PostgreSQL)427031091 — MySQL ERROR 1091 (42000): Can't DROP 'x'; check that column/key exists (MySQL)10911044 — 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)1054No 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…2BP01 — ERROR: cannot drop table x because other objects depend on it (PostgreSQL)2BP01additionalProperties — API Error: Request failed schema validation (must NOT have additional properties / Additional properties are not allowed) (API)additionalPropertiesRoom 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 …ImproperlyConfigured — 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)TemplateDoesNotExist1007 — 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)1067prepared statement exists — ERROR: prepared statement "s1" already exists (PgBouncer transaction mode) (PostgreSQL)prepared statement …55006 — ERROR: database "x" is being accessed by other users — There is 1 other session using the database. (PostgreSQL)55006Document failed validation — MongoDB: MongoServerError: Document failed validation (code 121) (MongoDB)Document failed val…

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.

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.

requires a primary key to be defined.NET

EF Core: The entity type 'X' requires a primary key to be defined

EF Core found an entity class without a key property it can recognise.

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…

Cannot access a disposed context instance.NET

ObjectDisposedException: Cannot access a disposed context instance

Code used a DbContext after its scope ended — usually async void, fire-and-forget tasks, or capturing a scoped context in a singl…

42P01PostgreSQL

PostgreSQL: ERROR: relation "x" does not exist

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

1146MySQL

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

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

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.

42P07PostgreSQL

ERROR: relation "x" already exists

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

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.

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.

42701PostgreSQL

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

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

Two steps away (36)

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.

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.

NullReferenceException.NET

System.NullReferenceException: Object reference not set to an instance of an object

Code dereferenced a variable that is `null` — the .NET equivalent of Java’s NullPointerException.

500.30.NET

HTTP Error 500.30 - ASP.NET Core app failed to start

IIS/Azure’s ASP.NET Core Module launched your app but it crashed during startup.

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…

No database provider has been configured.NET

InvalidOperationException: No database provider has been configured for this DbContext

EF Core created a DbContext without UseSqlServer/UseNpgsql/UseSqlite — typically because the context was newed up manually or reg…

A second operation was started on this context.NET

EF Core: A second operation was started on this context instance before a previous operation completed

The same DbContext was used concurrently — async calls not awaited, parallel tasks sharing a context, or a context registered as…

cannot be tracked because another instance with the same key.NET

The instance of entity type 'X' cannot be tracked because another instance with the same key value for {'Id'} is already being tracked

Two different objects with the same primary key were attached to one DbContext.

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.

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.

The LINQ expression could not be translated.NET

EF Core: The LINQ expression 'x' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly

The query uses C# code EF Core can’t convert to SQL — custom methods, unsupported string/date functions, or complex projections.

500.19.NET

HTTP Error 500.19 - Internal Server Error: The requested page cannot be accessed because the related configuration data for the page is invalid

IIS can’t read web.config — usually the ASP.NET Core Hosting Bundle (AspNetCoreModuleV2) or URL Rewrite module isn’t installed, o…

An unhandled error has occurred.NET

Blazor: An unhandled error has occurred. Reload 🗙

A Blazor component threw an exception; Blazor Server tears down the circuit (or WebAssembly logs to the console) and shows the re…

28P01PostgreSQL

PostgreSQL: FATAL: password authentication failed for user

PostgreSQL rejected the password for that role, or pg_hba.conf requires a different auth method.

42703PostgreSQL

PostgreSQL: ERROR: column "x" does not exist

PostgreSQL can’t find the column — a missing migration, a case-sensitive quoted name, or a string literal written in double quote…

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.

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

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.

2BP01PostgreSQL

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

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

additionalPropertiesAPI

API Error: Request failed schema validation (must NOT have additional properties / Additional properties are not allowed)

The JSON body doesn’t match the endpoint’s schema — an unknown property, wrong nesting, or a missing required object.

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.

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.

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.

prepared statement existsPostgreSQL

ERROR: prepared statement "s1" already exists (PgBouncer transaction mode)

Named prepared statements collided — typically because PgBouncer in transaction pooling mode hands connections between clients.

55006PostgreSQL

ERROR: database "x" is being accessed by other users — There is 1 other session using the database.

DROP/RENAME DATABASE can’t run while other sessions are connected.

Document failed validationMongoDB

MongoDB: MongoServerError: Document failed validation (code 121)

The collection has a JSON Schema validator and the inserted/updated document doesn’t satisfy it.