{"record":{"id":"ca5bd8723754c1ff","repo":"dotnet/efcore","slug":"there-is-no-property-mapped-to-the-column-table","errorCode":null,"errorMessage":"There is no property mapped to the column '{table}.{column}' which is used in a data operation. Either add a property mapped to this column, or specify the column types in the data operation.","messagePattern":"There is no property mapped to the column '(.+?)\\.(.+?)' which is used in a data operation\\. Either add a property mapped to this column, or specify the column types in the data operation\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Migrations/MigrationsSqlGenerator.cs","lineNumber":1182,"sourceCode":"        string? schema,\n        IModel? model)\n    {\n        var table = model?.GetRelationalModel().FindTable(tableName, schema ?? model.GetDefaultSchema());\n        if (table == null)\n        {\n            throw new InvalidOperationException(\n                RelationalStrings.DataOperationNoTable(\n                    FormatTable(tableName, schema)));\n        }\n\n        var properties = new IColumnMapping[names.Length];\n        for (var i = 0; i < names.Length; i++)\n        {\n            var name = names[i];\n            var column = table.FindColumn(name);\n            if (column == null)\n            {\n                throw new InvalidOperationException(\n                    RelationalStrings.DataOperationNoProperty(\n                        FormatTable(tableName, schema), name));\n            }\n\n            properties[i] = column.PropertyMappings.First();\n        }\n\n        return properties;\n    }\n\n    /// <summary>\n    ///     Generates a SQL fragment configuring a sequence in a <see cref=\"AlterSequenceOperation\" />.\n    /// </summary>\n    /// <param name=\"operation\">The operation.</param>\n    /// <param name=\"model\">The target model which may be <see langword=\"null\" /> if the operations exist without a model.</param>\n    /// <param name=\"builder\">The command builder to use to add the SQL fragment.</param>\n    protected virtual void SequenceOptions(\n        AlterSequenceOperation operation,","sourceCodeStart":1164,"sourceCodeEnd":1200,"githubUrl":"https://github.com/dotnet/efcore/blob/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.Relational/Migrations/MigrationsSqlGenerator.cs#L1164-L1200","documentation":"Thrown by MigrationsSqlGenerator.GetPropertyMappings when a data seeding/migration operation (InsertData, UpdateData, DeleteData) names a column that cannot be resolved on the target table in the relational model. EF looks up the column via table.FindColumn(name) and, finding null, aborts because it cannot map the value to a property. This protects the generator from emitting SQL against a non-existent column.","triggerScenarios":"Calling migrationBuilder.InsertData/UpdateData/DeleteData with a Columns array containing a column name that is not present on the modeled table; running a migration where the model was later changed to rename/remove a column but the data operation was not updated; generating data operations from a snapshot that is out of sync with the migration.","commonSituations":"Renaming a property/column without regenerating the migration; manually editing a migration's InsertData columns list; shadow properties that were expected but not configured; typos in column names inside hand-written data operations; running migrations against a model where the column was dropped in a prior migration not reflected in the snapshot.","solutions":["Verify the column name in the data operation exactly matches a property/column mapped on the entity in the current model (check the IModel snapshot).","If the column was renamed, update the data operation's Columns/values to the new name, or regenerate the migration with 'dotnet ef migrations add'.","If you intended to seed a shadow/shared column, add a property mapping for that column on the entity (e.g. configure it in OnModelCreating) so the model knows about it.","If the column should genuinely not exist, remove it from the Columns and Values arrays of the data operation."],"exampleFix":"// before - column 'LastName' was renamed to 'Surname'\nmigrationBuilder.InsertData(\n    table: \"Users\",\n    columns: new[] { \"Id\", \"LastName\" },\n    values: new object[,] { { 1, \"Smith\" } });\n\n// after\nmigrationBuilder.InsertData(\n    table: \"Users\",\n    columns: new[] { \"Id\", \"Surname\" },\n    values: new object[,] { { 1, \"Smith\" } });","handlingStrategy":"validation","validationCode":"var table = dbContext.Model.GetRelationalModel().FindTable(\"Users\", schema);\nvar exists = table?.FindColumn(\"Surname\") != null;\nif (!exists) throw new InvalidOperationException($\"Column Surname not present on table Users; fix the migration before applying.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Regenerate migrations after renaming columns instead of hand-editing column lists.","Keep the model snapshot committed and in sync with migrations.","Validate data-operation column names against the model in a unit test that builds the migration."],"tags":["efcore","migrations","data-seeding","schema-mismatch"],"analyzedSha":"dbf9771522148d61a2467854921bd5dc6f6e6916","analyzedAt":"2026-08-06T20:46:03.226Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}