Adding a Label to an Attachment Returns an Error

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

When Confluence users try to add a label to an attachment to a page, an error returns as seen in the screenshot below:

(Auto-migrated image: description temporarily unavailable)

Confluence logs the following stack trace:

1 2 3 4 5 6 7 8 9 -- url: /confluence/rest/ui/1.0/attachment/117347218/labels | userName: shimon | referer: http://localhost:8090/conf/pages/viewpageattachments.action?pageId=103252421 2014-09-07 15:20:58,445 ERROR [http-8090-188] [sf.hibernate.impl.SessionImpl] execute Could not synchronize database state with session -- url: /confluence/rest/ui/1.0/attachment/117638197/labels | userName: shimon | referer: http://localhost:8090/conf/pages/viewpageattachments.action?pageId=103252421 2014-09-07 15:20:58,447 ERROR [http-8090-188] [confluence.ui.rest.LoggingExceptionMapper] toResponse Exception while processing REST request: Hibernate operation: could not insert: [com.atlassian.confluence.labels.Labelling#117833847]; SQL []; ORA-01400: cannot insert NULL into ("CONF"."CONTENT_LABEL"."CONTENTID") ; nested exception is java.sql.SQLIntegrityConstraintViolationException: ORA-01400: cannot insert NULL into ("CONF"."CONTENT_LABEL"."CONTENTID") -- url: /confluence/rest/ui/1.0/attachment/117347218/labels | userName: shimon | referer: http://localhost:8090/conf/pages/viewpageattachments.action?pageId=103252421 org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not insert: [com.atlassian.confluence.labels.Labelling#117833847]; SQL []; ORA-01400: cannot insert NULL into ("CONF"."CONTENT_LABEL"."CONTENTID") ; nested exception is java.sql.SQLIntegrityConstraintViolationException: ORA-01400: cannot insert NULL into ("CONF"."CONTENT_LABEL"."CONTENTID")

Cause

Confluence always inserts a NULL value into the CONTENTID column of the CONTENT_LABEL table when it tries to add a label to an attachment. This is done before executing an UPDATE command to fill in the correct CONTENTID. This issue occurs because the CONTENT_LABEL table does not allow a NULL value in the CONTENTID column when it is supposed to allow it.

Resolution

ALTER the CONTENT_LABEL table to allow the CONTENTID column to contain a NULL value. Please refer to the following details:

Please backup your database before performing any modifications

  1. MySQL : Alter Table Page

  2. PostgreSQL : Alter Table Page

  3. Oracle :

    1 2 3 4 5 6 ALTER TABLE CONTENT_LABEL modify ( CONTENTID NUMBER(19,0) );
Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.