{"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/3a2006ef569de08368d59db5e1468aa8f407e4f8/src/EFCore.Relational/Metadata/Internal/StoredProcedure.cs#L602-L638","documentation":"A stored procedure cannot project the same property into two result columns. AddResultColumn(propertyName) throws when _propertyResultColumns already contains that property name, since each mapped property may contribute at most one output column.","triggerScenarios":"Calling .ResultColumn(\"CreatedAt\") twice on the same procedure, or calling it once explicitly when convention/attribute mapping already added a result column for that property (e.g. a computed property auto-mapped as a result column).","commonSituations":"Adding explicit result columns on top of auto-discovered ones after an EF Core upgrade changed convention behavior; shared fluent code between insert and update procedures where the same property is re-listed; mapping a store-generated (computed/default) property that conventions already treat as a result column.","solutions":["Call FindResultColumn(propertyName) before adding; only add when it returns null.","Remove the duplicate .ResultColumn(propertyName) call.","If the property is store-generated, let conventions create the result column and do not add it manually.","Audit each procedure's GetResultColumns() to confirm no duplicates before fluent configuration."],"exampleFix":"// before\nsp.ResultColumn(\"RowVersion\");\nsp.ResultColumn(\"RowVersion\"); // throws: duplicate\n\n// after\nif (sp.FindResultColumn(\"RowVersion\") is null)\n{\n    sp.ResultColumn(\"RowVersion\");\n}","handlingStrategy":"validation","validationCode":"// Add a result column only if no column exists for that property.\nif (sp.FindResultColumn(propertyName) is null)\n{\n    sp.ResultColumn(propertyName);\n}","typeGuard":"static bool CanAddResultColumn(IStoredProcedure sp, string propertyName)\n    => sp.FindResultColumn(propertyName) is null;","tryCatchPattern":null,"preventionTips":["Build a small wrapper that checks FindResultColumn before adding.","Avoid manually adding result columns for store-generated properties that conventions already map.","Unit-test procedure configurations against the finalized model."],"tags":["ef-core","stored-procedure","configuration","result-column","model-building"],"backgroundTag":null,"analyzedSha":"3a2006ef569de08368d59db5e1468aa8f407e4f8","analyzedAt":"2026-08-11T23:42:04.146Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}