{"record":{"id":"7248799d9e3d3778","repo":"dotnet/efcore","slug":"the-result-column-for-the-property-property-ca","errorCode":null,"errorMessage":"The result column for the property '{property}' cannot be added to the stored procedure '{sproc}' because another result column for this property already exists.","messagePattern":"The result column for the property '(.+?)' cannot be added to the stored procedure '(.+?)' because another result column for this property already exists\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Metadata/Internal/StoredProcedure.cs","lineNumber":620,"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 StoredProcedureResultColumn? FindResultColumn(string propertyName)\n        => _propertyResultColumns.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 StoredProcedureResultColumn AddResultColumn(string propertyName)\n    {\n        if (_propertyResultColumns.ContainsKey(propertyName))\n        {\n            throw new InvalidOperationException(\n                RelationalStrings.StoredProcedureDuplicateResultColumn(\n                    propertyName, ((IReadOnlyStoredProcedure)this).GetStoreIdentifier()?.DisplayName()));\n        }\n\n        var resultColumn = new StoredProcedureResultColumn(this, forRowsAffected: false, propertyName);\n        _resultColumns.Add(resultColumn);\n        _propertyResultColumns.Add(propertyName, resultColumn);\n\n        return resultColumn;\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 StoredProcedureResultColumn? FindRowsAffectedResultColumn()","sourceCodeStart":602,"sourceCodeEnd":638,"githubUrl":"https://github.com/dotnet/efcore/blob/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.Relational/Metadata/Internal/StoredProcedure.cs#L602-L638","documentation":"Thrown by StoredProcedure.AddResultColumn when a result column for the given property is already in _propertyResultColumns. Each property can have at most one result column on a stored procedure (used to read back generated/mutated values).","triggerScenarios":"StoredProcedure.cs:618-623: _propertyResultColumns.ContainsKey(propertyName) is true. Produced by calling .ResultColumn(\"Id\") / AddResultColumn twice for the same property.","commonSituations":"Calling .ResultColumn(x => x.Id) twice; mixing lambda and string overloads; reconfiguring an INSERT sproc's identity readback and adding the column again.","solutions":["Guard with FindResultColumn(propertyName) before adding.","Remove the duplicate .ResultColumn call.","Configure each readback property once per sproc."],"exampleFix":"// before\ns.AddResultColumn(\"Id\");\ns.AddResultColumn(\"Id\"); // throws\n\n// after\nif (s.FindResultColumn(\"Id\") == null) s.AddResultColumn(\"Id\");","handlingStrategy":"validation","validationCode":"static StoredProcedureResultColumn AddResultColumnOnce(StoredProcedure sproc, string propertyName)\n    => sproc.FindResultColumn(propertyName) ?? sproc.AddResultColumn(propertyName);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Guard AddResultColumn with FindResultColumn.","Configure each readback property once per sproc."],"tags":["relational","stored-procedure","result-column","duplicate"],"analyzedSha":"dbf9771522148d61a2467854921bd5dc6f6e6916","analyzedAt":"2026-08-06T20:46:03.226Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}