Multiple AttachmentData objects were returned when only one was expected for attachment

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

  1. Cannot rebuild indicies from scratch after upgrade
  2. Cannot search successfully

The following appears in the atlassian-confluence.log:

org.springframework.dao.IncorrectResultSizeDataAccessException: Multiple AttachmentData objects were returned when only one was expected for attachment: Attachment: <attachment name and id>
        at com.atlassian.confluence.pages.persistence.dao.hibernate.HibernateAttachmentDataDao.getAttachmentDataForAttachment(HibernateAttachmentDataDao.java:77)

Cause

There are duplicates in the attachmentdata table, most likely due to this bug  CONF-7882 - Getting issue details... STATUS

Resolution

  1. Identify duplicates from attachmentdata table in the database

    select attachmentdataid, attachmentid, attversion, count(*) from ATTACHMENTDATA group by attachmentid, attachmentdataid, attversion having count(*)>1;
  2. Delete the duplicates that have the same attachmentid and attversion, leaving the version which has the greatest attachmentdataid:

    delete from ATTACHMENTDATA where attachmentdataid=<put in attachmentdataids here>;
  3. Last step is to How to Rebuild the Content Indexes From Scratch on Confluence Server


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Last modified on Mar 30, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.