Unable to delete a Confluence space due to "deleted object would be re-saved by cascade" error
This article only applies to Atlassian's server products. Learn more about the differences between cloud and server.
This Knowledge Base article was written specifically for Atlassian Data Center applications. The contents of this article do not apply to Server installations or the Atlassian Cloud platform.
It is not possible to delete a Confluence space. The process hangs in the UI and the following appears in the
2019-08-26 12:00:17,288 ERROR [Long running task: Space removal long running task] [atlassian.confluence.event.ConfluenceEventDispatcher] run There was an exception thrown trying to dispatch event [com.atlassian.confluence.event.events.space.SpaceWillRemoveEvent[source=com.atlassian.confluence.spaces.DefaultSpaceManager@650ee893]] from the invoker [com.atlassian.confluence.event.ConfluenceListenerHandlersConfiguration$TimingListenerHandler$1$1@2da97d25] -- space: 11111111 | url: /spaces/doremovespace.action | traceId: e0eb56d25a6493e4 | userName: admin | referer: http://localhost:8090/spaces/removespace.action?key=KEY | action: doremovespace java.lang.RuntimeException: deleted object would be re-saved by cascade (remove deleted object from associations): [com.atlassian.confluence.pages.Page#1111111]. Listener: com.atlassian.confluence.core.listeners.BundledContentSpaceRemovalListener event: com.atlassian.confluence.event.events.space.SpaceWillRemoveEvent at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:55)
Notice you may see several errors like the one above in the logs, mentioning different objects. To confirm you are facing this issue before running the workaround, check if in one of the messages the associated item is the one below:
If you see one or more messages with this object mentioned, the associations causing the problem are pages in the trash.
To avoid this problem, purge the space trash before deleting the space as follows:
- Go to the space you want to delete and choose Space tools > Content Tools from the bottom of the sidebar
- Choose Trash
- Choose Purge all to completely empty the trash
- Try to delete the space again
It is not yet clear how to replicate this issue. Ideally, the space deletion tool would remove all objects associated with it automatically. However, there is a special condition not identified yet that can cause this situation.