The INSERT statement conflicted with the FOREIGN KEY constraint "FK_umbracoRedirectUrl".
I've upgraded a site from 7.2 to 7.5b2, and when I save and publish some content, I get the below error. Any advice/help?
System.Data.SqlClient.SqlException: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_umbracoRedirectUrl". The conflict occurred in database "thh", table "dbo.umbracoNode", column 'uniqueID'.
The statement has been terminated.
Stack trace below:
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.SqlDataReader.TryConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteScalar()
at Umbraco.Core.Persistence.PetaPocoCommandExtensions.<>cDisplayClassa.9()
at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func1 func)
at Umbraco.Core.Persistence.Database.Insert(String tableName, String primaryKeyName, Boolean autoIncrement, Object poco)
at Umbraco.Core.Persistence.Database.Insert(Object poco)
at Umbraco.Core.Persistence.Repositories.RedirectUrlRepository.PersistNewItem(IRedirectUrl entity)
at Umbraco.Core.Cache.DefaultRepositoryCachePolicy2.CreateOrUpdate(TEntity entity, Action1 persistMethod)
at Umbraco.Core.Persistence.Repositories.RepositoryBase2.PersistNewItem(IEntity entity)
at Umbraco.Core.Persistence.UnitOfWork.PetaPocoUnitOfWork.Commit(Action1 transactionCompleting)
at Umbraco.Core.Services.RedirectUrlService.Register(String url, Guid contentKey)
at Umbraco.Web.Redirects.RedirectTrackingEventHandler.CreateRedirect(Int32 contentId, Guid contentKey, String oldRoute)
at Umbraco.Web.Redirects.RedirectTrackingEventHandler.PageCacheRefresher_CacheUpdated(PageCacheRefresher sender, CacheRefresherEventArgs cacheRefresherEventArgs)
at Umbraco.Core.Events.TypedEventHandler2.Invoke(TSender sender, TEventArgs e)
at Umbraco.Core.Cache.CacheRefresherBase1.OnCacheUpdated(TInstanceType sender, CacheRefresherEventArgs args)
at Umbraco.Core.Sync.ServerMessengerBase.DeliverLocal[T](ICacheRefresher refresher, MessageType messageType, Func2 getId, IEnumerable1 instances)
at Umbraco.Core.Sync.ServerMessengerBase.Deliver[T](IEnumerable1 servers, ICacheRefresher refresher, MessageType messageType, Func2 getId, IEnumerable1 instances)
at Umbraco.Web.Cache.DistributedCache.Refresh[T](Guid factoryGuid, Func2 getNumericId, T[] instances)
at Umbraco.Web.Cache.DistributedCacheExtensions.RefreshPageCache(DistributedCache dc, IContent[] content)
at Umbraco.Web.Cache.CacheRefresherEventHandler.PublishingStrategy_Published(IPublishingStrategy sender, PublishEventArgs1 e)
at Umbraco.Core.Events.TypedEventHandler2.Invoke(TSender sender, TEventArgs e)
at Umbraco.Core.Events.EventExtensions.RaiseEvent[TSender,TArgs](TypedEventHandler2 eventHandler, TArgs args, TSender sender)
at Umbraco.Core.Services.ContentService.SaveAndPublishDo(IContent content, Int32 userId, Boolean raiseEvents)
at Umbraco.Core.Services.ContentService.Umbraco.Core.Services.IContentServiceOperations.SaveAndPublish(IContent content, Int32 userId, Boolean raiseEvents)
at Umbraco.Core.Services.ContentService.SaveAndPublishWithStatus(IContent content, Int32 userId, Boolean raiseEvents)
at Umbraco.Web.Editors.ContentController.PostSave(ContentItemSave contentItem)
at lambda_method(Closure , Object , Object[] )
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>cDisplayClass10.9(Object instance, Object[] methodParameters)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ApiControllerActionInvoker.
I seem to have fixed this by publishing all nodes once (you get the above errors) and then publishing them again (no more errors). Something in the DB isn't in sync it seems, but a double publish seems to clear it up.
I have this error after the upgrade from 7.4.3 to 7.5.13
There is no fix exists:
2017-04-29 14:16:49,208 [P6012/D8/T5] ERROR Umbraco.Web.Install.Controllers.InstallApiController - An error occurred during installation step DatabaseUpgrade
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Umbraco.Web.Install.InstallException: The database failed to upgrade. ERROR: The database configuration failed with the following message: There are no primary or candidate keys in the referenced table 'umbracoNode' that match the referencing column list in the foreign key 'FKumbracoRedirectUrl'.
Could not create constraint. See previous errors.
Please check log file for additional information (can be found in '/AppData/Logs/UmbracoTraceLog.txt')
at Umbraco.Web.Install.InstallSteps.DatabaseUpgradeStep.Execute(Object model)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Umbraco.Web.Install.Controllers.InstallApiController.ExecuteStep(InstallSetupStep step, JToken instruction)
at Umbraco.Web.Install.Controllers.InstallApiController.PostPerformInstall(InstallInstructions installModel)
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_umbracoRedirectUrl".
I've upgraded a site from 7.2 to 7.5b2, and when I save and publish some content, I get the below error. Any advice/help?
System.Data.SqlClient.SqlException: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_umbracoRedirectUrl". The conflict occurred in database "thh", table "dbo.umbracoNode", column 'uniqueID'. The statement has been terminated.
Stack trace below:
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action
1 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.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource
1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteScalar() at Umbraco.Core.Persistence.PetaPocoCommandExtensions.<>cDisplayClassa.9() at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func1 func) at Umbraco.Core.Persistence.Database.Insert(String tableName, String primaryKeyName, Boolean autoIncrement, Object poco) at Umbraco.Core.Persistence.Database.Insert(Object poco) at Umbraco.Core.Persistence.Repositories.RedirectUrlRepository.PersistNewItem(IRedirectUrl entity) at Umbraco.Core.Cache.DefaultRepositoryCachePolicy
2.CreateOrUpdate(TEntity entity, Action1 persistMethod) at Umbraco.Core.Persistence.Repositories.RepositoryBase
2.PersistNewItem(IEntity entity) at Umbraco.Core.Persistence.UnitOfWork.PetaPocoUnitOfWork.Commit(Action1 transactionCompleting) at Umbraco.Core.Services.RedirectUrlService.Register(String url, Guid contentKey) at Umbraco.Web.Redirects.RedirectTrackingEventHandler.CreateRedirect(Int32 contentId, Guid contentKey, String oldRoute) at Umbraco.Web.Redirects.RedirectTrackingEventHandler.PageCacheRefresher_CacheUpdated(PageCacheRefresher sender, CacheRefresherEventArgs cacheRefresherEventArgs) at Umbraco.Core.Events.TypedEventHandler
2.Invoke(TSender sender, TEventArgs e) at Umbraco.Core.Cache.CacheRefresherBase1.OnCacheUpdated(TInstanceType sender, CacheRefresherEventArgs args) at Umbraco.Core.Sync.ServerMessengerBase.DeliverLocal[T](ICacheRefresher refresher, MessageType messageType, Func
2 getId, IEnumerable1 instances) at Umbraco.Core.Sync.ServerMessengerBase.Deliver[T](IEnumerable
1 servers, ICacheRefresher refresher, MessageType messageType, Func2 getId, IEnumerable
1 instances) at Umbraco.Web.Cache.DistributedCache.Refresh[T](Guid factoryGuid, Func2 getNumericId, T[] instances) at Umbraco.Web.Cache.DistributedCacheExtensions.RefreshPageCache(DistributedCache dc, IContent[] content) at Umbraco.Web.Cache.CacheRefresherEventHandler.PublishingStrategy_Published(IPublishingStrategy sender, PublishEventArgs
1 e) at Umbraco.Core.Events.TypedEventHandler2.Invoke(TSender sender, TEventArgs e) at Umbraco.Core.Events.EventExtensions.RaiseEvent[TSender,TArgs](TypedEventHandler
2 eventHandler, TArgs args, TSender sender) at Umbraco.Core.Services.ContentService.SaveAndPublishDo(IContent content, Int32 userId, Boolean raiseEvents) at Umbraco.Core.Services.ContentService.Umbraco.Core.Services.IContentServiceOperations.SaveAndPublish(IContent content, Int32 userId, Boolean raiseEvents) at Umbraco.Core.Services.ContentService.SaveAndPublishWithStatus(IContent content, Int32 userId, Boolean raiseEvents) at Umbraco.Web.Editors.ContentController.PostSave(ContentItemSave contentItem) at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>cDisplayClass10.9(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ApiControllerActionInvoker.I seem to have fixed this by publishing all nodes once (you get the above errors) and then publishing them again (no more errors). Something in the DB isn't in sync it seems, but a double publish seems to clear it up.
FYI: we're investigating the issue and will update the tracker with more info once we've debugged it: http://issues.umbraco.org/issue/U4-8992
Issue has been reproduced and is being fixed, check the tracker.
Where are the explanations on how to fix it?
I have this error after the upgrade from 7.4.3 to 7.5.13 There is no fix exists:
2017-04-29 14:16:49,208 [P6012/D8/T5] ERROR Umbraco.Web.Install.Controllers.InstallApiController - An error occurred during installation step DatabaseUpgrade System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Umbraco.Web.Install.InstallException: The database failed to upgrade. ERROR: The database configuration failed with the following message: There are no primary or candidate keys in the referenced table 'umbracoNode' that match the referencing column list in the foreign key 'FKumbracoRedirectUrl'. Could not create constraint. See previous errors. Please check log file for additional information (can be found in '/AppData/Logs/UmbracoTraceLog.txt') at Umbraco.Web.Install.InstallSteps.DatabaseUpgradeStep.Execute(Object model) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Umbraco.Web.Install.Controllers.InstallApiController.ExecuteStep(InstallSetupStep step, JToken instruction) at Umbraco.Web.Install.Controllers.InstallApiController.PostPerformInstall(InstallInstructions installModel)
is working on a reply...