{"record":{"id":"d6583fcbb8273333","repo":"dotnet/efcore","slug":"the-parameter-for-the-property-property-cannot","errorCode":null,"errorMessage":"The parameter for the property '{property}' cannot be added to the stored procedure '{sproc}' because another parameter for this property already exists.","messagePattern":"The parameter for the property '(.+?)' cannot be added to the stored procedure '(.+?)' because another parameter for this property already exists\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Metadata/Internal/StoredProcedure.cs","lineNumber":513,"sourceCode":"    ///     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    public virtual StoredProcedureParameter? FindParameter(string propertyName)\n        => _currentValueParameters.GetValueOrDefault(propertyName);\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    public virtual StoredProcedureParameter AddParameter(string propertyName)\n    {\n        if (_currentValueParameters.ContainsKey(propertyName))\n        {\n            throw new InvalidOperationException(\n                RelationalStrings.StoredProcedureDuplicateParameter(\n                    propertyName, ((IReadOnlyStoredProcedure)this).GetStoreIdentifier()?.DisplayName()));\n        }\n\n        var parameter = new StoredProcedureParameter(this, rowsAffected: false, propertyName, originalValue: false);\n        _parameters.Add(parameter);\n        _currentValueParameters.Add(propertyName, parameter);\n\n        return parameter;\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    public virtual StoredProcedureParameter? FindOriginalValueParameter(string propertyName)","sourceCodeStart":495,"sourceCodeEnd":531,"githubUrl":"https://github.com/dotnet/efcore/blob/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.Relational/Metadata/Internal/StoredProcedure.cs#L495-L531","documentation":"Thrown by StoredProcedure.AddParameter when a current-value parameter for the given property name is already present in _currentValueParameters. Each property can have at most one current-value parameter on a stored procedure.","triggerScenarios":"StoredProcedure.cs:511-516: _currentValueParameters.ContainsKey(propertyName) is true. Produced by calling .AddParameter(\"X\") twice, or by EF automatically adding a parameter and then user code adding it again.","commonSituations":"Calling .Parameter(x => x.Name) twice; mixing the lambda and string overloads for the same property; scaffolding a sproc and then re-adding parameters manually.","solutions":["Guard with FindParameter(propertyName) before calling AddParameter.","Remove the duplicate .Parameter/.AddParameter call for the same property.","If reconfiguring, call the builder only once per property."],"exampleFix":"// before\ns.AddParameter(\"Name\");\ns.AddParameter(\"Name\"); // throws\n\n// after\nif (s.FindParameter(\"Name\") == null) s.AddParameter(\"Name\");","handlingStrategy":"validation","validationCode":"static StoredProcedureParameter AddParameterOnce(StoredProcedure sproc, string propertyName)\n    => sproc.FindParameter(propertyName) ?? sproc.AddParameter(propertyName);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always guard AddParameter with FindParameter.","Avoid mixing lambda and string parameter overloads for the same property."],"tags":["relational","stored-procedure","parameter","duplicate"],"analyzedSha":"dbf9771522148d61a2467854921bd5dc6f6e6916","analyzedAt":"2026-08-06T20:46:03.226Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}