Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Mitchell Fenwick 5 posts 85 karma points
    Jul 05, 2022 @ 21:45
    Mitchell Fenwick
    0

    Sql Exception when adding property to document type

    Hi There,

    Hopefully, someone out there can help me with a problem I am facing. I am suddenly running into an error when attempting to add a new property to a document type within Umbraco. This error occurs when saving the document type after adding a new property.

    This has not been an issue in the past, we have successfully been able to develop a full website in this current installation of Umbraco and deploy it live. The issue has only started occurring in the last week or so, although it is consistent and occurs every time.

    Current Umbraco version: 8.18.4 (was previously on 8.16.0 but tried updating to see if that would resolve the issue, it hasn't)

    Error details: "Violation of PRIMARY KEY constraint 'PK_cmsContentNu'. Cannot insert duplicate key in object 'dbo.cmsContentNu'. The duplicate key value is (2524, 0). The statement has been terminated."

    Exception details: "System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'PK_cmsContentNu'. Cannot insert duplicate key in object 'dbo.cmsContentNu'. The duplicate key value is (2524, 0). The statement has been terminated."

    Stack trace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlBulkCopy.RunParser(BulkCopySimpleResultSet bulkCopyHandler) at System.Data.SqlClient.SqlBulkCopy.CopyBatchesAsyncContinuedOnSuccess(BulkCopySimpleResultSet internalResults, String updateBulkCommandText, CancellationToken cts, TaskCompletionSource1 source) at System.Data.SqlClient.SqlBulkCopy.CopyBatchesAsyncContinued(BulkCopySimpleResultSet internalResults, String updateBulkCommandText, CancellationToken cts, TaskCompletionSource1 source) at System.Data.SqlClient.SqlBulkCopy.CopyBatchesAsync(BulkCopySimpleResultSet internalResults, String updateBulkCommandText, CancellationToken cts, TaskCompletionSource1 source) at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalRestContinuedAsync(BulkCopySimpleResultSet internalResults, CancellationToken cts, TaskCompletionSource1 source) at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalRestAsync(CancellationToken cts, TaskCompletionSource1 source) at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalAsync(CancellationToken ctoken) at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServerAsync(Int32 columnCount, CancellationToken ctoken) at System.Data.SqlClient.SqlBulkCopy.WriteToServer(IDataReader reader) at Umbraco.Core.Persistence.NPocoDatabaseExtensions.BulkInsertRecordsSqlServer[T](IUmbracoDatabase database, PocoData pocoData, IEnumerable1 records) in D:\a\1\s\src\Umbraco.Core\Persistence\NPocoDatabaseExtensions-Bulk.cs:line 286 at Umbraco.Web.PublishedCache.NuCache.PublishedSnapshotService.RebuildContentDbCacheLocked(IContentCacheDataSerializer serializer, IScope scope, Int32 groupSize, IEnumerable1 contentTypeIds) in D:\a\1\s\src\Umbraco.Web\PublishedCache\NuCache\PublishedSnapshotService.cs:line 1550 at Umbraco.Web.PublishedCache.NuCache.PublishedSnapshotService.RebuildContentDbCache(Int32 groupSize, IEnumerable1 contentTypeIds) in D:\a\1\s\src\Umbraco.Web\PublishedCache\NuCache\PublishedSnapshotService.cs:line 1488 at Umbraco.Web.PublishedCache.NuCache.PublishedSnapshotService.OnContentTypeRefreshedEntity(IContentTypeService sender, EventArgs args) in D:\a\1\s\src\Umbraco.Web\PublishedCache\NuCache\PublishedSnapshotService.cs:line 1321 at Umbraco.Core.Services.Implement.ContentTypeServiceBase3.Save(TItem item, Int32 userId) in D:\a\1\s\src\Umbraco.Core\Services\Implement\ContentTypeServiceBaseOfTRepositoryTItemTService.cs:line 439 at Umbraco.Web.Editors.ContentTypeControllerBase1.PerformPostSave[TContentTypeDisplay,TContentTypeSave,TPropertyType](TContentTypeSave contentTypeSave, Func2 getContentType, Action1 saveContentType, Action1 beforeCreateNew) in D:\a\1\s\src\Umbraco.Web\Editors\ContentTypeControllerBase.cs:line 297 at Umbraco.Web.Editors.ContentTypeController.PostSave(DocumentTypeSave contentTypeSave) in D:\a\1\s\src\Umbraco.Web\Editors\ContentTypeController.cs:line 298 at lambdamethod(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>cDisplayClass62.

    Would appreciate any help with this as I can not find any solutions online.

    Kind regards, Mitchell

  • Mitchell Fenwick 5 posts 85 karma points
    Jul 05, 2022 @ 21:48
    Mitchell Fenwick
    0

    Here is trace log also: "{"@t":"2022-07-05T21:44:47.9032408Z","@mt":"The query returned multiple property sets for content {ContentId}, {ContentTypeName}","@l":"Warning","ContentId":2524,"ContentTypeName":"Agency General Detail","SourceContext":"Umbraco.Core.Persistence.Repositories.Implement.ContentRepositoryBase3[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[Umbraco.Core.Models.IContent, Umbraco.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null],[Umbraco.Core.Persistence.Repositories.Implement.DocumentRepository, Umbraco.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null]]","ProcessId":18300,"ProcessName":"iisexpress","ThreadId":314,"AppDomainId":5,"AppDomainAppId":"LMW3SVC2ROOT","MachineName":"hercules","Log4NetLevel":"WARN ","HttpRequestNumber":11,"HttpRequestId":"02978847-a4c5-4593-923a-b1036bf8dd68"} {"@t":"2022-07-05T21:44:47.9032408Z","@mt":"The query returned multiple property sets for content {ContentId}, {ContentTypeName}","@l":"Warning","ContentId":2524,"ContentTypeName":"Agency General Detail","SourceContext":"Umbraco.Core.Persistence.Repositories.Implement.ContentRepositoryBase3[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[Umbraco.Core.Models.IContent, Umbraco.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null],[Umbraco.Core.Persistence.Repositories.Implement.DocumentRepository, Umbraco.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null]]","ProcessId":18300,"ProcessName":"iisexpress","ThreadId":314,"AppDomainId":5,"AppDomainAppId":"LMW3SVC2ROOT","MachineName":"hercules","Log4NetLevel":"WARN ","HttpRequestNumber":11,"HttpRequestId":"02978847-a4c5-4593-923a-b1036bf8dd68"} {"@t":"2022-07-05T21:44:56.3213064Z","@mt":"The query returned multiple property sets for content {ContentId}, {ContentTypeName}","@l":"Warning","ContentId":2524,"ContentTypeName":"Agency General Detail","SourceContext":"Umbraco.Core.Persistence.Repositories.Implement.ContentRepositoryBase3[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[Umbraco.Core.Models.IContent, Umbraco.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null],[Umbraco.Core.Persistence.Repositories.Implement.DocumentRepository, Umbraco.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null]]","ProcessId":18300,"ProcessName":"iisexpress","ThreadId":302,"AppDomainId":5,"AppDomainAppId":"LMW3SVC2ROOT","MachineName":"hercules","Log4NetLevel":"WARN ","HttpRequestNumber":12,"HttpRequestId":"7366fe59-8818-444c-ad68-9de44df0c772"} {"@t":"2022-07-05T21:44:56.3213064Z","@mt":"The query returned multiple property sets for content {ContentId}, {ContentTypeName}","@l":"Warning","ContentId":2524,"ContentTypeName":"Agency General Detail","SourceContext":"Umbraco.Core.Persistence.Repositories.Implement.ContentRepositoryBase3[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[Umbraco.Core.Models.IContent, Umbraco.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null],[Umbraco.Core.Persistence.Repositories.Implement.DocumentRepository, Umbraco.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null]]","ProcessId":18300,"ProcessName":"iisexpress","ThreadId":302,"AppDomainId":5,"AppDomainAppId":"LMW3SVC2ROOT","MachineName":"hercules","Log4NetLevel":"WARN ","HttpRequestNumber":12,"HttpRequestId":"7366fe59-8818-444c-ad68-9de44df0c772"} {"@t":"2022-07-05T21:45:19.5616797Z","@mt":"The query returned multiple property sets for content {ContentId}, {ContentTypeName}","@l":"Warning","ContentId":2524,"ContentTypeName":"Agency General Detail","SourceContext":"Umbraco.Core.Persistence.Repositories.Implement.ContentRepositoryBase3[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[Umbraco.Core.Models.IContent, Umbraco.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null],[Umbraco.Core.Persistence.Repositories.Implement.DocumentRepository, Umbraco.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null]]","ProcessId":18300,"ProcessName":"iisexpress","ThreadId":301,"AppDomainId":5,"AppDomainAppId":"LMW3SVC2ROOT","MachineName":"hercules","Log4NetLevel":"WARN ","HttpRequestNumber":13,"HttpRequestId":"3661656e-970b-4f21-96bd-d63e3ed3ce7d"} {"@t":"2022-07-05T21:45:19.5616797Z","@mt":"The query returned multiple property sets for content {ContentId}, {ContentTypeName}","@l":"Warning","ContentId":2524,"ContentTypeName":"Agency General Detail","SourceContext":"Umbraco.Core.Persistence.Repositories.Implement.ContentRepositoryBase3[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[Umbraco.Core.Models.IContent, Umbraco.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null],[Umbraco.Core.Persistence.Repositories.Implement.DocumentRepository, Umbraco.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null]]","ProcessId":18300,"ProcessName":"iisexpress","ThreadId":301,"AppDomainId":5,"AppDomainAppId":"LMW3SVC2ROOT","MachineName":"hercules","Log4NetLevel":"WARN ","HttpRequestNumber":13,"HttpRequestId":"3661656e-970b-4f21-96bd-d63e3ed3ce7d"} {"@t":"2022-07-05T21:45:21.4187503Z","@mt":"Unhandled controller exception occurred for request '{RequestUrl}'","@l":"Error","@x":"System.Data.SqlClient.SqlException (0x80131904): Violation of PRIMARY KEY constraint 'PKcmsContentNu'. Cannot insert duplicate key in object 'dbo.cmsContentNu'. The duplicate key value is (2524, 0).\r\nThe statement has been terminated.\r\n at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction)\r\n at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)\r\n at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)\r\n at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)\r\n at System.Data.SqlClient.SqlBulkCopy.RunParser(BulkCopySimpleResultSet bulkCopyHandler)\r\n at System.Data.SqlClient.SqlBulkCopy.CopyBatchesAsyncContinuedOnSuccess(BulkCopySimpleResultSet internalResults, String updateBulkCommandText, CancellationToken cts, TaskCompletionSource1 source)\r\n at System.Data.SqlClient.SqlBulkCopy.CopyBatchesAsyncContinued(BulkCopySimpleResultSet internalResults, String updateBulkCommandText, CancellationToken cts, TaskCompletionSource1 source)\r\n at System.Data.SqlClient.SqlBulkCopy.CopyBatchesAsync(BulkCopySimpleResultSet internalResults, String updateBulkCommandText, CancellationToken cts, TaskCompletionSource1 source)\r\n at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalRestContinuedAsync(BulkCopySimpleResultSet internalResults, CancellationToken cts, TaskCompletionSource1 source)\r\n at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalRestAsync(CancellationToken cts, TaskCompletionSource1 source)\r\n at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalAsync(CancellationToken ctoken)\r\n at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServerAsync(Int32 columnCount, CancellationToken ctoken)\r\n at System.Data.SqlClient.SqlBulkCopy.WriteToServer(IDataReader reader)\r\n at Umbraco.Core.Persistence.NPocoDatabaseExtensions.BulkInsertRecordsSqlServer[T](IUmbracoDatabase database, PocoData pocoData, IEnumerable1 records) in D:\\a\\1\\s\\src\\Umbraco.Core\\Persistence\\NPocoDatabaseExtensions-Bulk.cs:line 286\r\n at Umbraco.Web.PublishedCache.NuCache.PublishedSnapshotService.RebuildContentDbCacheLocked(IContentCacheDataSerializer serializer, IScope scope, Int32 groupSize, IEnumerable1 contentTypeIds) in D:\a\1\s\src\Umbraco.Web\PublishedCache\NuCache\PublishedSnapshotService.cs:line 1550\r\n at Umbraco.Web.PublishedCache.NuCache.PublishedSnapshotService.RebuildContentDbCache(Int32 groupSize, IEnumerable1 contentTypeIds) in D:\\a\\1\\s\\src\\Umbraco.Web\\PublishedCache\\NuCache\\PublishedSnapshotService.cs:line 1488\r\n at Umbraco.Web.PublishedCache.NuCache.PublishedSnapshotService.OnContentTypeRefreshedEntity(IContentTypeService sender, EventArgs args) in D:\\a\\1\\s\\src\\Umbraco.Web\\PublishedCache\\NuCache\\PublishedSnapshotService.cs:line 1321\r\n at Umbraco.Core.Services.Implement.ContentTypeServiceBase3.Save(TItem item, Int32 userId) in D:\a\1\s\src\Umbraco.Core\Services\Implement\ContentTypeServiceBaseOfTRepositoryTItemTService.cs:line 439\r\n at Umbraco.Web.Editors.ContentTypeControllerBase1.PerformPostSave[TContentTypeDisplay,TContentTypeSave,TPropertyType](TContentTypeSave contentTypeSave, Func2 getContentType, Action1 saveContentType, Action1 beforeCreateNew) in D:\a\1\s\src\Umbraco.Web\Editors\ContentTypeControllerBase.cs:line 297\r\n at Umbraco.Web.Editors.ContentTypeController.PostSave(DocumentTypeSave contentTypeSave) in D:\a\1\s\src\Umbraco.Web\Editors\ContentTypeController.cs:line 298\r\n at lambdamethod(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>cDisplayClass6_2.2(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.

Please Sign in or register to post replies

Write your reply to:

Draft