Bamboo upgrade fails in UpgradeTask 70205 with error "No row with the given identifier exists".
Platform Notice: Server and Data Center Only. This article only applies to Atlassian products on the server and data center platforms.
Summary
Bamboo upgrade process will break in task 70205 when trying to upgrade to version 7.2.1 or higher, showing the message "No row with the given identifier exists".
Environment
Bamboo running with a version older than 7.2.1.
Diagnosis
During the upgrade, Bamboo will fail with the following error and left in an inconsistent state:
2020-12-15 13:01:17,103 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] -----------------------------------------------------------------------
2020-12-15 13:01:17,103 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] 70205 : Fix artifact references in deployment projects (post-bootstrap)
2020-12-15 13:01:17,103 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] -----------------------------------------------------------------------
2020-12-15 13:01:17,327 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [DefaultLoadEventListener] HHH000327: Error performing load command
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.atlassian.bamboo.plan.artifact.ArtifactDefinitionImpl#454098962]
(...HIBERNATE STUFF...)
at com.atlassian.bamboo.deployments.projects.persistence.DeploymentProjectDaoImpl.lambda$getProjectItems$10(DeploymentProjectDaoImpl.java:217)
at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:385)
at org.springframework.orm.hibernate5.HibernateTemplate.execute(HibernateTemplate.java:337)
at com.atlassian.bamboo.deployments.projects.persistence.DeploymentProjectDaoImpl.getProjectItems(DeploymentProjectDaoImpl.java:213)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at com.sun.proxy.$Proxy121.getProjectItems(Unknown Source)
at com.atlassian.bamboo.upgrade.tasks.v7_2.UpgradeTask70205FixDeploymentArtifacts.lambda$doUpgrade$3(UpgradeTask70205FixDeploymentArtifacts.java:56)
Cause
In version 7.2.1 Bamboo implemented Upgrade Task 70205 to fix record on the DB of deployment artifacts defined by project items that don't exist anymore. If there is data in an inconsistent state, then this error will appear in the logs. The problem of the corruption is also described here: - BAM-21053Getting issue details... STATUS
Solution
For the upgrade to work you will need to directly modify data in the database to fix the problem. Please Contact Atlassian Support for guidance on how to fix this, and mention this article for reference.