Cloning a Deployment Project in Bamboo fails with 500 Internal server exception

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

While cloning a Deployment Project 500 Internal server exception is thrown. The error text states > unable to find Deployment project with id 0.

This error is seen on the Bamboo GUI when trying to clone a deployment Project, see below

(Auto-migrated image: description temporarily unavailable)

Environment

Issue seen in 8.0.4.

Diagnosis

  • 500 Internal server error is seen on the screen when trying to clone a Deployment project. See below error snippet from atlassian-bamboo.logfile.

    1 2 3 4 5 ERROR [http-nio-8085-exec-38] [FiveOhOh] 500 Exception was thrown. java.lang.IllegalArgumentException: Multiple entries with same key: batchs=com.atlassian.bamboo.plan.artifact.ArtifactDefinitionImpl@0 and batchs=com.atlassian.bamboo.plan.artifact.ArtifactDefinitionImpl@0. To index multiple values under a key, use Multimaps.index. at com.google.common.collect.Maps.uniqueIndex(Maps.java:1279) at com.google.common.collect.Maps.uniqueIndex(Maps.java:1234) at com.atlassian.bamboo.deployments.projects.service.DeploymentProjectServiceImpl.getArtifactDefinitionsForPlan(DeploymentProjectServiceImpl.java:1069)

Cause

The cause of the issue is duplicate artifacts definition linked to the build plan which is in-turn is linked to the Deployment project.

Investigation

Investigation of the Issue can be done in two ways ( either via Bamboo GUI or via running SQL queries in Bamboo DB )

Investigation via Bamboo GUI

  • From the Bamboo home screen, click on Deploy >> All deployment projects and select the deployment project with the issue.

  • The deployment project summary page will clearly show two artifacts with similar names linked to the same build plan; see one sample error below.

    1 2 3 Deployment project summary Source build plan Shanky › TestPlan Available artifacts art1, art1

 Investigation via Bamboo DB

  • The scope of the DB queries is to identify the duplicate artifact definition and the job where it is defined.

  • First query identifies the total duplicate artifact definitions in the DB.

    1 2 3 4 5 6 7 Select s.stage_id,a.label,a.chain_artifact FROM artifact_definition a JOIN build j ON a.producer_job_id = j.build_id JOIN chain_stage s ON j.stage_id = s.stage_id GROUP BY s.stage_id,a.label,a.chain_artifact having COUNT(*) > 1

Sample result : 

(Auto-migrated image: description temporarily unavailable)
  • In the next step, replace the <label> and <stageid> from the previous query in the below SQL and get the job details where the artifact definitions are defined.

    1 2 3 4 5 6 7 8 9 select a.artifact_definition_id,j.build_id,j.full_key,j.build_type,s.stage_id from artifact_definition a JOIN build j ON a.producer_job_id = j.build_id JOIN chain_stage s ON j.stage_id = s.stage_id WHERE a.label = 'label' -- replace from the first query AND a.chain_artifact = true AND s.stage_id = stage_id -- replace from the first query

            Sample result : 

(Auto-migrated image: description temporarily unavailable)

Solution

  • The solution to the Issue is to remove the duplicate artifacts identified from the cause above.

  • From the Bamboo home screen, go to Builds >> All build plans >> Select the Build plan having an Issue.

  • Click on configure Plan and select the Job which has been identified from section above, the below screen would be displayed with the duplicate artifact. 

    (Auto-migrated image: description temporarily unavailable)
  • Delete or edit the duplicate artifact definition to make sure both of them don't have the same name.

  • The issue with Deployment project cloning would be resolved. 

Updated on March 3, 2025

Still need help?

The Atlassian Community is here for you.