Error map

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

.NET · layer 4, Application & API

Open the full error page →

Centre: this error. First ring: errors it is linked with (8). 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.

requires a primary key to be defined — EF Core: The entity type 'X' requires a primary key to be defined (.NET)requires a …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…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 …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 …JsonException 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…The 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…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)23505InvalidOperationException — InvalidOperationException: Unable to resolve service for type 'X' while attempting to activate 'Y' (.NET)InvalidOperationExc…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 …1146 — MySQL ERROR 1146 (42S02): Table 'db.table' doesn't exist (MySQL)114642P01 — PostgreSQL: ERROR: relation "x" does not exist (PostgreSQL)42P011022 — MySQL ERROR 1022 (23000): Can't write; duplicate key in table (MySQL)1022409 — HTTP 409 Conflict (HTTP)409ConcurrentModificationException — java.util.ConcurrentModificationException (Java)ConcurrentModificat…412 — HTTP 412 Precondition Failed (HTTP)412RangeError — RangeError: Maximum call stack size exceeded (JavaScript)RangeErrorStackOverflowError — java.lang.StackOverflowError (Java)StackOverflowErrorMismatchedInputException — com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.util.ArrayList` from Object value (Java)MismatchedInputExce…413 — HTTP 413 Content Too Large (Request Entity Too Large) (HTTP)413redirect_uri_mismatch — OAuth Error: redirect_uri_mismatch (Authentication)redirect_uri_mismat…CreateContainerConfigError — Kubernetes: CreateContainerConfigError — secret / configmap not found (Kubernetes)CreateContainerConf…Sequence contains no elements — InvalidOperationException: Sequence contains no elements / more than one element (.NET)Sequence contains n…

Directly related (8)

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…

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.

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…

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…

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.

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.

Two steps away (19)

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.

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.

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…

1146MySQL

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

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

42P01PostgreSQL

PostgreSQL: ERROR: relation "x" does not exist

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

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.

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.

ConcurrentModificationExceptionJava

java.util.ConcurrentModificationException

A collection was modified while being iterated (even in a single thread).

412HTTP

HTTP 412 Precondition Failed

A conditional request header (If-Match, If-Unmodified-Since) didn’t match the current state of the resource.

RangeErrorJavaScript

RangeError: Maximum call stack size exceeded

A function called itself (directly or indirectly) too many times — usually infinite recursion.

StackOverflowErrorJava

java.lang.StackOverflowError

The thread’s call stack overflowed — almost always unbounded recursion, sometimes a bidirectional toString/equals/JSON cycle.

MismatchedInputExceptionJava

com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.util.ArrayList` from Object value

Jackson found JSON whose shape doesn’t match the target Java type (object vs array, string vs number, missing constructor).

413HTTP

HTTP 413 Content Too Large (Request Entity Too Large)

The request body is bigger than the server is willing to accept — usually a file upload over the configured limit.

redirect_uri_mismatchAuthentication

OAuth Error: redirect_uri_mismatch

The redirect URI in your OAuth request doesn’t exactly match one registered for the client in the provider’s console.

CreateContainerConfigErrorKubernetes

Kubernetes: CreateContainerConfigError — secret / configmap not found

Kubernetes can’t build the container’s configuration — usually a referenced Secret, ConfigMap or key doesn’t exist in that namesp…

Sequence contains no elements.NET

InvalidOperationException: Sequence contains no elements / more than one element

LINQ `First()`, `Single()`, `Last()` or `Max()` ran on an empty sequence (or `Single()` found several items).