System error displays in the UI when viewing Space attachments
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
Problem
When navigating to Space Tools > Content Tools > Attachments (listattachmentsforspace.action), the list of attachments fails to load and a system error is thrown in the UI.
The following appears in the atlassian-confluence.log
and in the UI.
1
2
3
4
5
6
org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getDownloadPathWithoutVersion' in class
com.atlassian.confluence.pages.Attachment threw exception java.lang.NullPointerException at /pages/listattachmentsforspace.vm[line 56,
column 246]
at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:223)
caused by: java.lang.NullPointerException
at com.atlassian.confluence.util.ConfluenceRenderUtils.getAttachmentsPathForContent(ConfluenceRenderUtils.java:88)
Diagnosis
Diagnostic Steps
Run the following SQL query to locate any attachments with a NULL PageID:
1
select * from content where contenttype = 'ATTACHMENT' and spaceid = (select spaceid from spaces where spacekey = 'spacekey-from-affected-space');
Note the contentid for any attachments that have a NULL value in the pageid column.
Cause
This error occurs when there is an attachment with a NULL pageid in the database.
Solution
Workaround
Stop Confluence.
Run the following SQL to assign a valid pageid to any attachments that have a NULL value in the pageid column.
1
update content SET pageid = 'valid-pageid' where contentID = 'contentid-from-diagnostic';
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.
Start Confluence.
Once you've assigned a valid page, navigate to the page and move/delete the attachment as desired.
Was this helpful?