{"record":{"id":"12bbcd8864cd0867","repo":"dotnet/efcore","slug":"entitytype1-property1-and-entitytype2-pr-12bbcd","errorCode":null,"errorMessage":"'{entityType1}.{property1}' and '{entityType2}.{property2}' are both mapped to column '{columnName}' in '{table}', but have different fixed length configuration.","messagePattern":"'(.+?)\\.(.+?)' and '(.+?)\\.(.+?)' are both mapped to column '(.+?)' in '(.+?)', but have different fixed length configuration\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs","lineNumber":1576,"sourceCode":"                    previousMaxLength,\n                    currentMaxLength));\n        }\n\n        if (property.IsUnicode(storeObject) != duplicateProperty.IsUnicode(storeObject))\n        {\n            throw new InvalidOperationException(\n                RelationalStrings.DuplicateColumnNameUnicodenessMismatch(\n                    duplicateProperty.DeclaringType.DisplayName(),\n                    duplicateProperty.Name,\n                    property.DeclaringType.DisplayName(),\n                    property.Name,\n                    columnName,\n                    storeObject.DisplayName()));\n        }\n\n        if (property.IsFixedLength(storeObject) != duplicateProperty.IsFixedLength(storeObject))\n        {\n            throw new InvalidOperationException(\n                RelationalStrings.DuplicateColumnNameFixedLengthMismatch(\n                    duplicateProperty.DeclaringType.DisplayName(),\n                    duplicateProperty.Name,\n                    property.DeclaringType.DisplayName(),\n                    property.Name,\n                    columnName,\n                    storeObject.DisplayName()));\n        }\n\n        var currentPrecision = property.GetPrecision(storeObject);\n        var previousPrecision = duplicateProperty.GetPrecision(storeObject);\n        if (currentPrecision != previousPrecision)\n        {\n            throw new InvalidOperationException(\n                RelationalStrings.DuplicateColumnNamePrecisionMismatch(\n                    duplicateProperty.DeclaringType.DisplayName(),\n                    duplicateProperty.Name,\n                    property.DeclaringType.DisplayName(),","sourceCodeStart":1558,"sourceCodeEnd":1594,"githubUrl":"https://github.com/dotnet/efcore/blob/3a2006ef569de08368d59db5e1468aa8f407e4f8/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs#L1558-L1594","documentation":"Two properties sharing a column have conflicting IsFixedLength settings. Fixed length changes the store type (e.g. nchar vs nvarchar), so EF rejects the ambiguity rather than silently choosing one. Common on SQL Server where fixed-length columns pad with spaces.","triggerScenarios":"ValidateCompatible() checks property.IsFixedLength(storeObject) != duplicateProperty.IsFixedLength(storeObject) for a duplicate column. One property calls IsFixedLength() and the other does not (or sets the opposite).","commonSituations":"Table splitting where one partner sets IsFixedLength() for legacy compatibility; scaffolded model edited inconsistently; cross-provider migrations where fixed length was provider-specific.","solutions":["Apply the same IsFixedLength() setting to both properties.","Remove IsFixedLength() from one side so both fall back to the default (false).","Remap one property to a different column if fixed vs variable is genuinely required."],"exampleFix":"// before\nmodelBuilder.Entity<Credential>().Property(c => c.Token).IsFixedLength();\nmodelBuilder.Entity<CredentialMeta>().Property(m => m.Token); // shared column, default = not fixed\n\n// after\nmodelBuilder.Entity<Credential>().Property(c => c.Token).IsFixedLength();\nmodelBuilder.Entity<CredentialMeta>().Property(m => m.Token).IsFixedLength();","handlingStrategy":"validation","validationCode":"foreach (var (col, props) in sharedColumnGroups)\n{\n    var flags = props.Select(p => p.IsFixedLength(storeObject)).Distinct().ToList();\n    if (flags.Count > 1)\n        Console.WriteLine($\"Column {col} has conflicting fixed-length settings\");\n}","typeGuard":null,"tryCatchPattern":"try { _ = db.Model; } catch (InvalidOperationException ex) when (ex.Message.Contains(\"different fixed length configuration\")) { // align IsFixedLength on both properties }","preventionTips":["Apply IsFixedLength consistently across all entities sharing a column.","Question any use of fixed-length columns in modern schemas; remove if unnecessary.","Validate the model at startup."],"tags":["model-validation","column-mapping","fixed-length","relational"],"backgroundTag":null,"analyzedSha":"3a2006ef569de08368d59db5e1468aa8f407e4f8","analyzedAt":"2026-08-11T23:42:04.146Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}