{"record":{"id":"b8c85d244ab01494","repo":"dotnet/efcore","slug":"the-property-1-entitytype-0-property-could-n-b8c85d","errorCode":null,"errorMessage":"The property '{1_entityType}.{0_property}' could not be found. Ensure that the property exists and has been included in the model.","messagePattern":"The property '(.+?)\\.(.+?)' could not be found\\. Ensure that the property exists and has been included in the model\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Metadata/Builders/StoredProcedureBuilder.cs","lineNumber":220,"sourceCode":"    }\n\n    /// <summary>\n    ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to\n    ///     the same compatibility standards as public APIs. It may be changed or removed without notice in\n    ///     any release. You should only use it directly in your code with extreme caution and knowing that\n    ///     doing so can result in application failures when updating to a new Entity Framework Core release.\n    /// </summary>\n    [EntityFrameworkInternal]\n    protected virtual PropertyBuilder CreatePropertyBuilder(string propertyName)\n    {\n        var entityType = EntityTypeBuilder.Metadata;\n        var property = entityType.FindProperty(propertyName);\n        property ??= entityType.GetDerivedTypes().SelectMany(et => et.GetDeclaredProperties())\n            .FirstOrDefault(p => p.Name == propertyName);\n\n        if (property == null)\n        {\n            throw new InvalidOperationException(CoreStrings.PropertyNotFound(propertyName, entityType.DisplayName()));\n        }\n\n#pragma warning disable EF1001 // Internal EF Core API usage.\n        return new ModelBuilder(entityType.Model)\n#pragma warning restore EF1001 // Internal EF Core API usage.\n            .Entity(property.DeclaringType.Name)\n            .Property(property.ClrType, propertyName);\n    }\n\n    /// <summary>\n    ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to\n    ///     the same compatibility standards as public APIs. It may be changed or removed without notice in\n    ///     any release. You should only use it directly in your code with extreme caution and knowing that\n    ///     doing so can result in application failures when updating to a new Entity Framework Core release.\n    /// </summary>\n    [EntityFrameworkInternal]\n    protected virtual PropertyBuilder CreatePropertyBuilder<TDerivedEntity, TProperty>(\n        Expression<Func<TDerivedEntity, TProperty>> propertyExpression)","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/dotnet/efcore/blob/3a2006ef569de08368d59db5e1468aa8f407e4f8/src/EFCore.Relational/Metadata/Builders/StoredProcedureBuilder.cs#L202-L238","documentation":"StoredProcedureBuilder.CreatePropertyBuilder (internal) searches the entity type and its derived types' declared properties for a name. If nothing matches, it throws CoreStrings.PropertyNotFound. This fires when a stored-procedure mapping references a property name that is not declared on the entity or any derived type.","triggerScenarios":"Configuring an entity's stored procedure (InsertStoredProcedure/UpdateStoredProcedure/DeleteStoredProcedure) and passing a string property name that does not exist on the entity type or its derived types — e.g. .HasParameter(\"Nonexistent\"), a result-column binding, or an original-value binding with a wrong name.","commonSituations":"Renamed properties with stale sproc string mappings; typos; properties that exist only on a sibling (not derived) type; properties ignored from the model.","solutions":["Use the correct property name declared on the entity (or inherited from a base in the hierarchy).","Prefer the lambda overload (e.g. sp.HasParameter(e => e.Name)) for compile-time safety.","If the property should exist, ensure it is not ignored and is mapped on this entity type."],"exampleFix":"// before\nmodelBuilder.Entity<Order>()\n    .InsertStoredProcedure(\"InsertOrder\", sp => sp.HasParameter(\"CustId\")); // real name is 'CustomerId' -> [455]\n\n// after\nmodelBuilder.Entity<Order>()\n    .InsertStoredProcedure(\"InsertOrder\", sp => sp.HasParameter(o => o.CustomerId));","handlingStrategy":"type-guard","validationCode":"// Verify the property exists on the entity (or derived types) before configuring the sproc.\nvar et = entityTypeBuilder.Metadata;\nvar found = et.FindProperty(propertyName)\n    ?? et.GetDerivedTypes().SelectMany(d => d.GetDeclaredProperties()).FirstOrDefault(p => p.Name == propertyName);\nif (found is null)\n    throw new ArgumentException($\"Property '{propertyName}' not found on {et.DisplayName()}.\");","typeGuard":"static bool EntityOrDerivedHasProperty(IEntityType et, string name)\n    => et.FindProperty(name) is not null\n       || et.GetDerivedTypes().SelectMany(d => d.GetDeclaredProperties()).Any(p => p.Name == name);","tryCatchPattern":null,"preventionTips":["Prefer lambda-based sproc mapping overloads to avoid string typos.","Keep sproc string mappings in sync with property renames.","Add a model-build unit test to catch missing-property errors early."],"tags":["stored-procedures","metadata","builder"],"backgroundTag":null,"analyzedSha":"3a2006ef569de08368d59db5e1468aa8f407e4f8","analyzedAt":"2026-08-11T23:42:04.146Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}