{"record":{"id":"9912354da4199ae2","repo":"dotnet/efcore","slug":"unable-to-find-a-store-type-mapping-for-column-t","errorCode":null,"errorMessage":"Unable to find a store type mapping for column '{table}.{column}' with CLR type '{clrType}'.","messagePattern":"Unable to find a store type mapping for column '(.+?)\\.(.+?)' with CLR type '(.+?)'\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Migrations/MigrationsSqlGenerator.cs","lineNumber":1451,"sourceCode":"        var storeType = Dependencies.TypeMappingSource.FindMapping(\n                operation.ClrType,\n                null,\n                keyOrIndex,\n                operation.IsUnicode,\n                operation.MaxLength,\n                operation.IsRowVersion,\n                operation.IsFixedLength,\n                operation.Precision,\n                operation.Scale)\n            ?.StoreType;\n\n        if (storeType != null)\n        {\n            return storeType;\n        }\n\n        var fullTableName = schema != null ? $\"{schema}.{tableName}\" : tableName;\n        throw new InvalidOperationException(\n            RelationalStrings.UnsupportedTypeForColumn(fullTableName, name, operation.ClrType?.Name ?? \"unknown\"));\n    }\n\n    /// <summary>\n    ///     Generates a SQL fragment for the default constraint of a column.\n    /// </summary>\n    /// <param name=\"defaultValue\">The default value for the column.</param>\n    /// <param name=\"defaultValueSql\">The SQL expression to use for the column's default constraint.</param>\n    /// <param name=\"columnType\">Store/database type of the column.</param>\n    /// <param name=\"builder\">The command builder to use to add the SQL fragment.</param>\n    protected virtual void DefaultValue(\n        object? defaultValue,\n        string? defaultValueSql,\n        string? columnType,\n        MigrationCommandListBuilder builder)\n    {\n        if (defaultValueSql != null)\n        {","sourceCodeStart":1433,"sourceCodeEnd":1469,"githubUrl":"https://github.com/dotnet/efcore/blob/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.Relational/Migrations/MigrationsSqlGenerator.cs#L1433-L1469","documentation":"Thrown by MigrationsSqlGenerator.GetColumnType when neither the relational model's column store type nor Dependencies.TypeMappingSource.FindMapping can resolve a store type for the column's CLR type and facets. EF first tries to reuse the model column's StoreType, then falls back to the TypeMappingSource; if both return null it cannot emit a column type and throws InvalidOperationException.","triggerScenarios":"A column operation whose ClrType is a type the provider's type mapper does not know about (e.g. a custom struct/enum or an object/unknown type); a migration column where operation.ClrType is null (reported as 'unknown'); using a value type with no registered RelationalTypeMapping.","commonSituations":"Adding a property of an unmapped CLR type (e.g. a custom enum without HasConversion, a third-party type like NodaTime without the provider plugin); stripping ClrType in a hand-edited migration; provider plugin missing (e.g. NodaTime, NetTopologySuite) so its types are unmapped; a column operation built programmatically without setting ColumnType.","solutions":["Register a type mapping or conversion for the CLR type (e.g. modelBuilder.Entity<T>().Property(x => x.MyEnum).HasConversion<int>() or .HasColumnType(\"jsonb\")).","Install the missing provider plugin package that maps the type (e.g. NodaTime, NetTopologySuite for SQL Server/PostgreSQL).","Explicitly set operation.ColumnType (and the [Column(TypeName=...)] / HasColumnType) so GetColumnType short-circuits before reaching the mapping source.","If the CLR type is genuinely unsupported, change the property to a supported type or store it as a converted primitive (string/JSON)."],"exampleFix":"// before - custom enum type has no mapping\npublic class Order { public OrderStatus Status { get; set; } } // OrderStatus is a custom enum\n\n// after - explicit conversion + column type\nmodelBuilder.Entity<Order>()\n    .Property(o => o.Status)\n    .HasConversion<int>()\n    .HasColumnType(\"int\");","handlingStrategy":"validation","validationCode":"foreach (var et in dbContext.Model.GetEntityTypes())\nforeach (var p in et.GetProperties())\n{\n    var storeType = p.GetColumnType();\n    if (string.IsNullOrEmpty(storeType) && p.ClrType.IsEnum && !p.GetJsonValueConverter()?.GetType().IsValueType)\n        Console.WriteLine($\"{et}.{p.Name} ({p.ClrType}) has no store type mapping; add HasConversion/HasColumnType.\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Register HasConversion for custom enums/types in OnModelCreating.","Install provider plugins (NodaTime, NetTopologySuite) before using their types.","Set HasColumnType explicitly for any non-standard CLR type."],"tags":["efcore","migrations","type-mapping","clr-type","provider"],"analyzedSha":"dbf9771522148d61a2467854921bd5dc6f6e6916","analyzedAt":"2026-08-06T20:46:03.226Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}