Bamboo Specs publishing fails with a unique constraint violation.

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

When performing a Specs publish or scan, the process will fail and in the logs we will see a constraint violation.

Diagnosis

When the Specs process is running, it fails and in the logs we will see

atlassian-bamboo.log

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 2021-10-21 11:46:08,307 INFO [http-nio-8086-exec-22 url: /bamboo2/rest/api/latest/import/plan; user: user] [AbstractBatchImpl] HHH000010: On release of batch it still contained JDBC statements 2021-10-21 11:46:08,307 ERROR [http-nio-8086-exec-22 url: /bamboo2/rest/api/latest/import/plan; user: user] [BatchingBatch] HHH000315: Exception executing batch [java.sql.BatchUpdateException: ORA-00001: unique constraint (BAMBOODB.SYS_C0024117) violated ], SQL: insert into NOTIFICATION_SETS (SET_TYPE, NOTIFICATION_SET_ID) values (?, ?) 2021-10-21 11:46:08,308 WARN [http-nio-8086-exec-22 url: /bamboo2/rest/api/latest/import/plan; user: user] [SqlExceptionHelper] SQL Error: 1, SQLState: 23000 2021-10-21 11:46:08,308 ERROR [http-nio-8086-exec-22 url: /bamboo2/rest/api/latest/import/plan; user: user] [SqlExceptionHelper] ORA-00001: unique constraint (BAMBOODB.SYS_C0024117) violated 2021-10-21 11:46:08,330 ERROR [http-nio-8086-exec-22 url: /bamboo2/rest/api/latest/import/plan; user: user] [BambooPlanConfigImportResource] Unexpected exception while importing plan: org.springframework.dao.DataIntegrityViolationException: could not execute batch; SQL [insert into NOTIFICATION_SETS (SET_TYPE, NOTIFICATION_SET_ID) values (?, ?)]; constraint [BAMBOODB.SYS_C0024117]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute batch at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:245) at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:388) at org.springframework.orm.hibernate5.HibernateTemplate.execute(HibernateTemplate.java:337) at com.atlassian.bamboo.plan.PlanHibernateDao.getPlanByKey(PlanHibernateDao.java:82) at sun.reflect.GeneratedMethodAccessor1606.invoke(Unknown Source) (...) Caused by: org.hibernate.exception.ConstraintViolationException: could not execute batch (...) at com.atlassian.bamboo.plan.PlanHibernateDao$1.doInHibernate(PlanHibernateDao.java:93) at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:385) ... 313 more Caused by: java.sql.BatchUpdateException: ORA-00001: unique constraint (BAMBOODB.SYS_C0024117) violated at oracle.jdbc.driver.OraclePreparedStatement.executeLargeBatch(OraclePreparedStatement.java:10032) at oracle.jdbc.driver.T4CPreparedStatement.executeLargeBatch(T4CPreparedStatement.java:1364) at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9839) at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:234) at com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:128) at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(HikariProxyPreparedStatement.java) at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.performExecution(BatchingBatch.java:121) ... 332 more 2021-10-21 11:46:08,333 WARN [http-nio-8086-exec-22 url: /bamboo2/rest/api/latest/import/plan; user: user] [BambooRuntimeExceptionMapper] Unexpected error from REST call org.springframework.dao.DataIntegrityViolationException: could not execute batch; SQL [insert into NOTIFICATION_SETS (SET_TYPE, NOTIFICATION_SET_ID) values (?, ?)]; constraint [BAMBOODB.SYS_C0024117]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute batch at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:245) at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:388) at org.springframework.orm.hibernate5.HibernateTemplate.execute(HibernateTemplate.java:337) at com.atlassian.bamboo.plan.PlanHibernateDao.getPlanByKey(PlanHibernateDao.java:82) (...)

Cause

An error of this type might indicate that there is a problem with the notifications configured in the specs file, but actually there is a different Bamboo thread doing some sort of update, either at notification level or plan level.

Solution

The problem is not related to Specs code or the Specs process. If this problem happens, we recommend you to wait for some time, since most probably a different Bamboo process needs to finish first.

This behavior has been reported as a bug an its progress can be tracked here: BAM-21577 - Bamboo Specs publishing fails with a unique constraint violation

Updated on March 13, 2025

Still need help?

The Atlassian Community is here for you.