NullPointerException when trying to restore custom content version

I am trying to restore a content version of a custom content object using the restore content version REST API:

    fetch(`/rest/api/content/${encodeURIComponent(contentId)}/version`, {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json'
        body: JSON.stringify({
            operationKey: 'restore',
                versionNumber: 3,
                message: 'Restore'

It seems like for a given custom content object, the first time the operation succeeds. Any future attempt to restore a version on the same custom content object results in a 500 Internal Server Error with the message java.lang.NullPointerException: null.

Am I doing something wrong or is this a Confluence bug?

Furthermore, it seems that any calls to the get content version API fail with the same 500 (regardless of whether any version has been restored), while calls to the get content versions API succeed. However, the get content versions API raises the same error as soon as I try to expand content. This means that I have to way to retrieve the historic content!

Update: I have also reported this as ECOHELP-9126.


A fix has just been deployed, solving the problem. I’m impressed!