{"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/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.Relational/Metadata/Builders/StoredProcedureBuilder.cs#L202-L238","documentation":"Thrown by StoredProcedureBuilder.CreatePropertyBuilder(string) at StoredProcedureBuilder.cs:218-220 when the property name is not found on the entity type or any of its derived types. FindProperty is checked on the entity itself, then GetDerivedTypes().SelectMany(GetDeclaredProperties) is searched; if both fail, the exception is thrown.","triggerScenarios":"Calling stored procedure mapping methods (HasParameter, HasResultColumn, HasOriginalValueParameter, etc.) with a string property name that doesn't exist on the entity type or its inheritance descendants.","commonSituations":"Typo in the property name. Referencing a property from a different entity. Property renamed during refactoring but the stored procedure string wasn't updated. Shadow property not declared before use in stored procedure mapping.","solutions":["Verify the property name exactly matches a declared property (including derived types if using inheritance).","Declare a shadow property first with .Property<T>(\"Name\") if it's not a CLR property.","Use the strongly-typed lambda overload to get compile-time safety."],"exampleFix":"// before: property name doesn't exist\nmodelBuilder.Entity<User>()\n    .UpdateUsingStoredProcedure(sp => sp.HasParameter(\"EmailAddress\")); // property is 'Email'\n\n// after\nmodelBuilder.Entity<User>()\n    .UpdateUsingStoredProcedure(sp => sp.HasParameter(\"Email\"));","handlingStrategy":"type-guard","validationCode":"var et = entityTypeBuilder.Metadata;\nvar prop = et.FindProperty(propertyName)\n    ?? et.GetDerivedTypes().SelectMany(d => d.GetDeclaredProperties()).FirstOrDefault(p => p.Name == propertyName);\nif (prop == null) throw new ArgumentException($\"Property '{propertyName}' not found.\");\n// safe to proceed with stored procedure mapping","typeGuard":"// Prefer strongly-typed lambda overloads to get compile-time checking\nsp.HasParameter<TProperty>(e => e.MyProperty);","tryCatchPattern":null,"preventionTips":["Use lambda-based stored procedure configuration overloads for compile-time property validation.","Validate property names with FindProperty before string-based configuration.","Run model validation tests that exercise all stored procedure mappings."],"tags":["stored-procedure","property-not-found","configuration"],"analyzedSha":"dbf9771522148d61a2467854921bd5dc6f6e6916","analyzedAt":"2026-08-06T20:46:03.226Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}