{"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/3a2006ef569de08368d59db5e1468aa8f407e4f8/src/EFCore.Relational/Migrations/MigrationsSqlGenerator.cs#L1433-L1469","documentation":"Thrown by MigrationsSqlGenerator.GetColumnType when neither the relational model's column metadata nor the configured TypeMappingSource can resolve a store type for the column's CLR type. The relational provider cannot emit DDL for a type it cannot map.","triggerScenarios":"AddColumn/AlterColumn in a migration whose ClrType has no registered mapping (e.g. a custom struct/enum without a value converter, or third-party type). Fires when Dependencies.TypeMappingSource.FindMapping(...) returns null.","commonSituations":"Adding a property whose CLR type is not natively supported (e.g. ulong on some providers, custom enum, decimal without scale, NodaTime types without the plugin). Forgetting to register HasConversion. Missing provider-specific package (e.g. NodaTime, NetTopologySuite).","solutions":["Register a value converter on the property: builder.Property(x => x.Foo).HasConversion(...).","Install the provider extension package for the unsupported type (e.g. EFCore.NodaTime, EFCore.NetTopologySuite).","Change the CLR type to one the provider maps natively, or specify the store type explicitly via .HasColumnType(\"...\").","Provide columnType on the AddColumnOperation so the generator bypasses the FindMapping call."],"exampleFix":"// before\nmodelBuilder.Entity<Order>()\n    .Property(o => o.Flags); // Flags is a custom struct with no mapping\n\n// after\nmodelBuilder.Entity<Order>()\n    .Property(o => o.Flags)\n    .HasConversion(v => v.ToString(), v => MyFlags.Parse(v));\n// or\nmodelBuilder.Entity<Order>()\n    .Property(o => o.Flags)\n    .HasColumnType(\"nvarchar(max)\");","handlingStrategy":"validation","validationCode":"static void EnsureTypeMappable(IRelationalTypeMappingSource source, Type clrType)\n{\n    if (source.FindMapping(clrType) is null)\n        throw new InvalidOperationException($\"No store type mapping for CLR type {clrType}. Register a value converter or install the provider extension.\");\n}","typeGuard":"static bool HasMapping(IRelationalTypeMappingSource source, Type clrType)\n    => source.FindMapping(clrType) is not null;","tryCatchPattern":null,"preventionTips":["Install provider extension packages for non-native types (NodaTime, NetTopologySuite, enums).","Register HasConversion for unsupported CLR types.","Specify .HasColumnType on properties whose CLR type is exotic."],"tags":["ef-core","migrations","type-mapping","provider"],"backgroundTag":null,"analyzedSha":"3a2006ef569de08368d59db5e1468aa8f407e4f8","analyzedAt":"2026-08-11T23:42:04.146Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}