dotnet/efcore · error · InvalidOperationException

No property named '{property}' found on the entity type '{en

Error message

No property named '{property}' found on the entity type '{entityType}' corresponding to the parameter on the stored procedure '{sproc}'.

What it means

Thrown when an original-value parameter (HasOriginalValueParameter) references a property name not present in the valid property set for the entity and mapping strategy. The validator fails the lookup in originalValueProperties with TryGetAndRemove returning false. Original-value parameters must map to a real property.

Source

Thrown at src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs:709

                            entityType.DisplayName(), resultColumn.PropertyName, storeObjectIdentifier.DisplayName()));
                default:
                    Check.DebugFail("Unexpected stored procedure type: " + storeObjectIdentifier.StoreObjectType);
                    break;
            }
        }

        var originalValueProperties = new Dictionary<string, IProperty>(properties);
        var parameterNames = new HashSet<string>();
        foreach (var parameter in sproc.Parameters)
        {
            IProperty? property = null;
            if (parameter.PropertyName != null)
            {
                if (parameter.ForOriginalValue == true)
                {
                    if (!originalValueProperties.TryGetAndRemove(parameter.PropertyName, out property))
                    {
                        throw new InvalidOperationException(
                            RelationalStrings.StoredProcedureParameterNotFound(
                                parameter.PropertyName, entityType.DisplayName(), storeObjectIdentifier.DisplayName()));
                    }

                    if (storeObjectIdentifier.StoreObjectType == StoreObjectType.InsertStoredProcedure)
                    {
                        throw new InvalidOperationException(
                            RelationalStrings.StoredProcedureOriginalValueParameterOnInsert(
                                parameter.Name, storeObjectIdentifier.DisplayName()));
                    }
                }
                else
                {
                    if (!properties.TryGetAndRemove(parameter.PropertyName, out property))
                    {
                        throw new InvalidOperationException(
                            RelationalStrings.StoredProcedureParameterNotFound(
                                parameter.PropertyName, entityType.DisplayName(), storeObjectIdentifier.DisplayName()));

View on GitHub (pinned to dbf9771522)

Solutions

  1. Verify the property name matches an actual property on the entity.
  2. Check the mapping strategy ensures the property is in scope.
  3. Remove the original-value parameter if the property does not exist.

Example fix

// before
sp.HasOriginalValueParameter("RowVersionX"); // typo

// after
sp.HasOriginalValueParameter("RowVersion");
Defensive patterns

Strategy: validation

Validate before calling

foreach (var et in modelBuilder.Model.GetEntityTypes())
{
    var names = et.GetProperties().Select(p => p.Name).ToHashSet();
    foreach (var s in new[] { et.GetInsertStoredProcedure(), et.GetUpdateStoredProcedure(), et.GetDeleteStoredProcedure() }.Where(s => s != null))
        foreach (var p in s.Parameters.Where(p => p.ForOriginalValue == true && p.PropertyName != null))
            if (!names.Contains(p.PropertyName)) throw new InvalidOperationException($"Original-value param {p.PropertyName} not a property of {et.DisplayName()}");
}

Try / catch

try { _ = ctx.Model; } catch (InvalidOperationException ex) when (ex.Message.Contains("Original value parameter") && ex.Message.Contains("No property named")) { /* fix the original-value parameter property name */ }

Prevention

When it happens

Trigger: .HasOriginalValueParameter("TypoName"); referencing a removed/renamed property; referencing a property excluded by the mapping strategy.

Common situations: Renaming a property without updating original-value sproc config; changing mapping strategy so a base property is no longer in scope.

Related errors


AI-assisted analysis of dotnet/efcore@dbf9771522 (2026-08-06). Data as JSON: /api/errors/374a2daf61069bfd. Report an issue: GitHub.