Unable to delete a Confluence space due to "deleted object would be re-saved by cascade" error
Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.
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.