Bamboo upgrade fails with "FileAlreadyExistsException" for bamboo-mail.cfg.xml

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

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 upgrading Bamboo to version 8 or newer, the startup fails and shows "Bamboo bootstrap failed: Failed to run pre-bootstrap upgrade tasks". Upon checking the <bamboo-home>/logs/atlassian-bamboo.log file, the following error is present:

java.nio.file.FileAlreadyExistsException: <bamboo-home>/bamboo/shared/configuration/bamboo-mail.cfg.xml

Environment

Observed while upgrading Bamboo 7.x or older to any 8.x version or newer.

Diagnosis

The following error messages can be found in the <bamboo-home>/logs/atlassian-bamboo.log file:

2022-06-25 11:40:34,110 ERROR [localhost-startStop-1] [AbstractUpgradeManager] java.nio.file.FileAlreadyExistsException: <bamboo-home>/bamboo/shared/configuration/bamboo-mail.cfg.xml
java.nio.file.FileAlreadyExistsException: <bamboo-home>/bamboo/shared/configuration/bamboo-mail.cfg.xml
        at sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:429) ~[?:1.8.0_292]
        at sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:262) ~[?:1.8.0_292]
        at java.nio.file.Files.move(Files.java:1395) ~[?:1.8.0_292]
        at com.atlassian.bamboo.upgrade.tasks.v8_0.UpgradeTask70302ReorganiseHomeDirectory.doUpgrade(UpgradeTask70302ReorganiseHomeDirectory.java:53) ~[atlassian-bamboo-web-9.0.1.jar:?]
        at com.atlassian.bamboo.upgrade.AbstractUpgradeManager.runUpgradeTask(AbstractUpgradeManager.java:230) ~[atlassian-bamboo-upgrader-9.0.1.jar:?]
        at com.atlassian.bamboo.upgrade.BootstrapUpgradeManagerImpl.doUpgrade(BootstrapUpgradeManagerImpl.java:75) ~[atlassian-bamboo-upgrader-9.0.1.jar:?]
        at com.atlassian.bamboo.setup.DefaultBootstrapManager.performPersistenceUpgrade(DefaultBootstrapManager.java:385) ~[atlassian-bamboo-web-9.0.1.jar:?]
        at com.atlassian.config.bootstrap.DefaultAtlassianBootstrapManager.init(DefaultAtlassianBootstrapManager.java:74) ~[atlassian-config-1.1.3.jar:?] 
[...]
2022-11-10 15:03:54,678 FATAL [main] [DefaultBootstrapManager] Pre-bootstrap upgrade tasks failed
com.atlassian.upgrade.UpgradeException: Pre-bootstrap upgrade tasks failed: [Task for build 70302 failed with exception: <bamboo-home>/shared/configuration/bamboo-mail.cfg.xml]
        at com.atlassian.bamboo.setup.DefaultBootstrapManager.performPersistenceUpgrade(DefaultBootstrapManager.java:387) ~[atlassian-bamboo-web-9.0.1.jar:?]
[...]  

Cause

Bamboo version 8 introduced changes to the home directory structure to accommodate the Data Center needs, and there are upgrade tasks that perform these migrations and adjustments. One of the upgrade tasks moves the bamboo-mail.cfg.xml file, which contains Bamboo's mail configuration, from the legacy location into the new folder structure.

This error can happen if, somehow, the file already exists in the new location. This could happen from a failed previous upgrade attempt that wasn't fully rolled back, or if that file was manually added to the new location.

Solution

  1. Compare the two bamboo-mail.cfg.xml files to determine which one is valid:
    1. <bamboo-home>/shared/configuration/bamboo-mail.cfg.xml
    2. <bamboo-home>/bamboo-mail.cfg.xml
  2. If they are the same, move <bamboo-home>/shared/configuration/bamboo-mail.cfg.xml out to a temporary directory.
  3. If they are not the same, determine which one contains valid content (according to your Mail configuration) and move it to <bamboo-home>, leaving the <bamboo-home>/shared/configuration/ without any bamboo-mail.cfg.xml file.
  4. Restart Bamboo.

Last modified on Aug 31, 2023

Was this helpful?

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