Copying pages in Confluence fails with NullPointerException

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

When trying to copy an existing Confluence page, the following ERROR occurs in atlassian-confluence.log:

1 2 3 4 5 6 7 2015-06-05 11:21:00,803 ERROR [http-bio-8090-exec-10] [atlassian.confluence.pages.DefaultAttachmentManager] getAttachmentData Could not find data for attachment: Attachment: test.png v.1 (36971334) 2015-06-05 11:21:00,814 ERROR [http-bio-8090-exec-10] [atlassian.confluence.servlet.ConfluenceServletDispatcher] sendError Could not execute action -- referer: https://test.com/wiki/display/TEST/test | url: /wiki/pages/copypage.action | userName: t875571 java.lang.NullPointerException: inputStream cannot be null at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:204) at com.atlassian.confluence.pages.persistence.dao.AttachmentDataStream$InputStreamWrapper.<init>(AttachmentDataStream.java:43) at com.atlassian.confluence.pages.persistence.dao.filesystem.FileSystemAttachmentDataDao.rawBinaryWrapper(FileSystemAttachmentDataDao.java:155)

Cause

The attachment has been deleted from the filesystem but the attachment is still referenced by the page the user tried to copy.

Workaround

Delete the attachment reference from the database.

This is only applicable for Confluence 5.7.x and above.

Always back up your data before making any database modifications. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.

  1. Shut down Confluence.

  2. Identify the ID of the attachment that needs to be deleted. From the example above, the ID would be "36971334"

    1 2015-06-05 11:21:00,803 ERROR [http-bio-8090-exec-10] [atlassian.confluence.pages.DefaultAttachmentManager] getAttachmentData Could not find data for attachment: Attachment: test.png v.1 (36971334)
  3. Run the queries below to delete the attachment (replacing the contentid number with the number from the error):

    1 2 delete from contentproperties where CONTENTID = 36971334; delete from content where contentid = 36971334;
  4. Restart Confluence.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.