Creating a page in Confluence shows a blank nonfunctional editor and user Drafts page throws an error

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

A user tries to create a new page, the editor displays only a blank page and no further action is available in the editor causing the user to not be able to create new pages:

(Auto-migrated image: description temporarily unavailable)

The same user tries to access its Drafts page receives the following NullPointer error message:

(Auto-migrated image: description temporarily unavailable)

The problem resides in a draft with unexpected values in the content table (database). This article will explain how we can remove the problematic draft to resolve the problem.

Environment

This problem was identified in Confluence server and datacenter version 7.4.3. It could also affect other versions of Confluence.

Diagnosis

Trying to create a new page shows a blank page and no further action is available rendering the editor useless. The following error can be found in the atlassian-confluence.log file:

1 2 3 4 5 2021-05-04 19:36:50,308 ERROR [http-nio-8080-exec-41 url:/pages/createpage.action username:test] [confluence.util.velocity.VelocityUtils] writeRenderedTemplate Error occurred rendering template: templates/atlassian-editor.vm -- referer: https://confluence.com/pages/createpage.action?spaceKey=TEST&fromPageId=510827999 | url: /pages/createpage.action | traceId: 34b3cc2025c1660d | userName: test | action: createpage org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getRenderedTemplateHtml' in class com.atlassian.confluence.plugins.soy.VelocityFriendlySoyTemplateRenderer threw exception com.google.template.soy.tofu.SoyTofuException: When evaluating "getText('draft.warning.create.page.without.title', formatDateTime($existingDraft.lastModificationDate))": While computing function "formatDateTime($existingDraft.lastModificationDate)": null at templates/atlassian-editor.vm[line 479, column 36] ... Caused by: com.google.template.soy.tofu.SoyTofuException: When evaluating "getText('draft.warning.create.page.without.title', formatDateTime($existingDraft.lastModificationDate))": While computing function "formatDateTime($existingDraft.lastModificationDate)": null...Caused by: com.google.template.soy.sharedpasses.render.RenderException: While computing function "formatDateTime($existingDraft.lastModificationDate)": null

There's a rendering problem due to a null value in the lastModificationDate column in the content table related to a draft:

1 RenderException: While computing function "formatDateTime($existingDraft.lastModificationDate)": null

Double-check in the database by querying based on the affected user and space(s):

1 2 3 4 5 select * from content where contenttype = 'DRAFT' and draftspacekey = 'TEST' and lastmoddate is null and creator in (select user_key from user_mapping where username = 'test');

Both the draftspacekey and username can be found in the aforementioned log error and updated accordingly.

To further confirm that we're experiencing the problem reported in this article, follow the steps below:

  1. As a Confluence administrator, confirm that Collaborative Editing is OFF.

  2. As a Confluence administrator, we can impersonate the user with the free app User Switcher for Confluence or ask the affected user(s) to check their Drafts page.

  3. With the user logged in, click in its user profile at the top right corner (avatar) >> Drafts

  4. This page weill error out in the UI confirming that the problem is with the drafts.

  5. Confirm the time this was performed and double-check in the atlassian-confluence.log file for the error

This issue may affect one or more users and one or more spaces. It's possible that the problem only occurs with Collaborative Editing disabled. Re-enabling Collaborative Editing won't fix this.

Cause

There's a rendering problem due to a null value in the lastModificationDate column in the content table related to a draft:

1 RenderException: While computing function "formatDateTime($existingDraft.lastModificationDate)": null

Solution

Deleting the drafts from the UI isn't possible so we have two options, REST API or via SQL query.

Rest API

  1. The SQL query from the diagnose section will contain the contentid of the problematic drafts that we're going to use in the REST API call

  2. Update the following command accordingly to your site configuration and query results:

1 curl -u <username>:<password> -v -X DELETE "http://<confluenceURL>/rest/api/content/<contentid>?status=draft" | python -mjson.tool

The verbose flag is to assist in case the command fails to run

SQL Query

  1. The SQL query from the diagnose section will be used as a sub-query for the delete script

  2. Schedule a time to shutdown Confluence and backup the database

    1. It's recommended to perform this in a staging environment first before applying to a production site

  3. Copy and safe the following code block as .sql file. Update it accordingly to the affected space and user. Run it.

    BlankDraftDelete.sql

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 DELETE FROM NOTIFICATIONS WHERE CONTENTID IN (select contentid from content where contenttype = 'DRAFT' and draftspacekey = '<spacekey>' and lastmoddate is null and creator in (select user_key from user_mapping where username = '<username')); DELETE FROM CONFANCESTORS WHERE ANCESTORID IN (select contentid from content where contenttype = 'DRAFT' and draftspacekey = '<spacekey>' and lastmoddate is null and creator in (select user_key from user_mapping where username = '<username')); DELETE FROM CONFANCESTORS WHERE DESCENDENTID IN (select contentid from content where contenttype = 'DRAFT' and draftspacekey = '<spacekey>' and lastmoddate is null and creator in (select user_key from user_mapping where username = '<username')); DELETE FROM BODYCONTENT WHERE CONTENTID IN (select contentid from content where contenttype = 'DRAFT' and draftspacekey = '<spacekey>' and lastmoddate is null and creator in (select user_key from user_mapping where username = '<username')); DELETE FROM CONTENTPROPERTIES WHERE CONTENTID IN (select contentid from content where contenttype = 'DRAFT' and draftspacekey = '<spacekey>' and lastmoddate is null and creator in (select user_key from user_mapping where username = '<username')); DELETE FROM CONTENTPROPERTIES WHERE CONTENTID IN (select contentid from CONTENT where PAGEID in (select contentid from content where contenttype = 'DRAFT' and draftspacekey = '<spacekey>' and lastmoddate is null and creator in (select user_key from user_mapping where username = '<username'))); DELETE FROM LINKS WHERE CONTENTID IN (select contentid from content where contenttype = 'DRAFT' and draftspacekey = '<spacekey>' and lastmoddate is null and creator in (select user_key from user_mapping where username = '<username')); DELETE FROM CONTENT_LABEL WHERE contentid IN (select contentid from content where contenttype = 'DRAFT' and draftspacekey = '<spacekey>' and lastmoddate is null and creator in (select user_key from user_mapping where username = '<username')); DELETE FROM usercontent_relation WHERE targetcontentid IN (select contentid from content where contenttype = 'DRAFT' and draftspacekey = '<spacekey>' and lastmoddate is null and creator in (select user_key from user_mapping where username = '<username')); DELETE FROM likes WHERE CONTENTID IN (select contentid from content where contenttype = 'DRAFT' and draftspacekey = '<spacekey>' and lastmoddate is null and creator in (select user_key from user_mapping where username = '<username>')); DELETE FROM IMAGEDETAILS WHERE ATTACHMENTID IN (select contentid from CONTENT where PAGEID in (select contentid from content where contenttype = 'DRAFT' and draftspacekey = '<spacekey>' and lastmoddate is null and creator in (select user_key from user_mapping where username = '<username'))); DELETE FROM CONTENT_PERM WHERE ID IN (select contentid from content where contenttype = 'DRAFT' and draftspacekey = '<spacekey>' and lastmoddate is null and creator in (select user_key from user_mapping where username = '<username')); DELETE FROM CONTENT_PERM_SET WHERE ID IN (select contentid from content where contenttype = 'DRAFT' and draftspacekey = '<spacekey>' and lastmoddate is null and creator in (select user_key from user_mapping where username = '<username')); DELETE FROM CONTENT WHERE PAGEID IN (select contentid from content where contenttype = 'DRAFT' and draftspacekey = '<spacekey>' and lastmoddate is null and creator in (select user_key from user_mapping where username = '<username')); DELETE FROM CONTENT WHERE CONTENTID IN (select contentid from content where contenttype = 'DRAFT' and draftspacekey = '<spacekey>' and lastmoddate is null and creator in (select user_key from user_mapping where username = '<username'));
  4. Restart Confluence and check the problem

Updated on April 14, 2025

Still need help?

The Atlassian Community is here for you.