Fetching page history through REST API throws a NullPointerException at HistoryBuilder.createdDate

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

Problem

Fetching pages through the REST API and expanding its history (e.g. history.lastupdated) results in a 500 HTTP code and the following error on the atlassian-confluence.log file:

1 2 3 4 5 [rest.api.model.ExceptionConverter] convertServiceException No status code found for exception, converting to internal server error : -- url: /rest/api/content/<ID>/child/page | traceId: xxxxx | userName: admin java.lang.NullPointerException at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:210) at com.atlassian.confluence.api.model.content.History$HistoryBuilder.createdDate(History.java:231)

Diagnostic Steps

Run the following query on the database to check for NULL values:

1 SELECT * from content where creationdate is NULL and content_status = 'current' and (contenttype = 'PAGE' or contenttype = 'BLOGPOST' or contenttype = 'ATTACHMENT');

Cause

If the query above returns any results, this is the cause of the problem. It is expected that all published versions of a given content should have valid dates in this column. If not, the NPE is returned when fetching its history.

⚠️ Notice that it is expected to have NULL values for that column if the content_status is DRAFT or DELETED. However, if the content_status is CURRENT, that should not happen.

Resolution

Run the following query to set valid dates for those entries:

1 UPDATE content SET creationdate ='2018-01-01 01:01:01.001', lastmoddate = '2018-01-01 01:01:01.001' where creationdate is NULL and content_status = 'current' and (contenttype = 'PAGE' or contenttype = 'BLOGPOST');

Ensure that you have stopped the application and taken a database backup before executing this query.

Note

It is not yet known why this situation may happen. In most of the cases where this has been seen, the pages affected were created in an unusual way (not from the UI). Below are the most common causes:

  1. Pages/spaces imported from other wiki tools

  2. Pages created using scripts or plugins

  3. Any other type of content migration

Updated on April 15, 2025

Still need help?

The Atlassian Community is here for you.