Running branch merge builds throws Merge Command Error: Runtime Exception
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
Problem
When running a build that performs a branch merge, the following error appears in the UI:
The following appears in the atlassian-bamboo.log
2016-06-22 10:11:02,891 WARN [6-DelayedChangeDetectionThread:pool-12-thread-48] [ChainExecutionManagerImpl] Merge command error: Runtime exception.
Diagnosis
To confirm this issue you can enable more detailed logging in Bamboo's com.atlassian.bamboo.chains.ChainExecutionManagerImpl
class:
- Go to Bamboo Admin >> Settings >> Log Settings
Add the following class and set the type to DEBUG:
ClassPath Type com.atlassian.bamboo.chains.ChainExecutionManagerImpl DEBUG Reproduce the issue and check
$BAMBOO_HOME/logs/atlassian-bamboo.log
for a line similar to the following:error: unable to resolve reference refs/heads/this-is-a-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-long-branch-name: Filename too long ! [new branch] this-is-a-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-long-branch-name -> this-is-a-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-long-branch-name (unable to update local ref)
Cause
When performing a merge, Bamboo will do a full checkout of the repository and will gather all the current branch names whilst updating the head. If one of the branch names is too long, it will cause the update head task to fail, and the merge of any branch will not be able to complete.
The maximum possible length of a branch name depends on a number of factors:
- Operating System
- On Windows systems, file path limits are much lower, and the unpacking of the branch head may exceed the file system path limit of 260 characters, so the length of the full path to the build working directory may be related
- Different versions of git may exhibit different limitations
- Bamboo's internal DB schema stores branch names in a 255 character field
Resolution
Check the repository in question for extremely long branch names and remove them if found, and subsequent builds of any branch should not run into this issue