Confluence Attachment Deleted or Not Found

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

Symptoms

An attachment in confluence was mistakenly deleted or is "not found".

Diagnosis

The structure of attachment storage in the database has changed in Confluence 5.7, and as such the queries below will not work. However, we suspect that this issue may now no longer occur.

If you experience this on 5.7 or above, please contact Atlassian support so we can help you resolve the issue and update this page.

Confluence may still have the attachment in the filesystem, to verify preform the following in the database:

1 2 title | character varying(255) | not null pageid | bigint | not null

ℹ️ The title and pageid are the most reliable ways to search for the missing document.

  • Select query using title:

    1 SELECT * FROM attachments WHERE title = '<title of attachment>';
  • Select query using pageid:

    1 SELECT * FROM attachments WHERE pageid = <page ID>;

    ℹ️ The <page ID> can be found by selecting Edit on the Confluence page where the attachment was and viewing the URL once in edit mode (e.g. https://<base_url>/pages/editpage.action?pageId=<page ID>)

You're in luck if the attachment was found via one of the methods above and the attachment can be located in the Confluence filesystem.

Note: If you have an Atlassian Cloud instance you will not be able to perform the diagnosis or fix yourself, if you wish for Atlassian Cloud Support to perform this for you please file a support request and reference this article.

Resolution

  • If the attachment was retrieved by using one of the methods under Diagnosis, a table much like the following should be displayed:

    1 2 3 attachmentid | title | contenttype | pageid | <attachmentid> | <title of attachment> | <contenttype> | <page ID> | (1 row)

    ℹ️ Take note of the <attachmentid>, this will be used to search the filesystem.

  • Move to the Confluence attachments directory in the filesystem

    1 $ cd /data/jirastudio/confluence/home/attachments/
  • Find the attachmentid and move to that directory

    1 2 3 4 5 $ find -name <attachmentid> ./41/233/983041/161/31/2031661/<attachmentid> $ cd /41/233/983041/161/31/2031661/<attachmentid> $ ls 1 2 3

    ℹ️ If a list of numbers appear as above, these represent versions of the attachment.

  • scp the desired version(s) to your machine

    1  $ scp root@<base_url>:/data/jirastudio/confluence/home/attachments/ver003/172/129/2129922/196/150/37650446/<attachmentid>/3 /Desktop .
  • Restore the attachment to it's desired location in Confluence

Updated on April 1, 2025

Still need help?

The Atlassian Community is here for you.