Can't detect branches for plan error even though the Automatic branch management is disabled
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
Automatic branch management is disabled.
The Plan Summary page have the error "Can't detect branches for plan PROJ-PLAN"
The following appears in the atlassian-bamboo.log
2016-05-31 16:39:15,101 DEBUG [11-BranchDetectionBackgroundThread:pool-19-thread-2] [BranchDetectionServiceImpl] Detecting already existing branches for plan PROJ-PLAN
2016-05-31 16:39:15,463 INFO [11-BranchDetectionBackgroundThread:pool-19-thread-2] [DefaultErrorHandler] Recording an error: Can't detect branches for plan PROJ-PLAN
Cause
Bamboo detected a branch to be initialized for that Plan in the database and try to connect to the repository to initialize it.
Resolution
- Shutdown Bamboo
- Backup database for rollback purposes
Search for the problematic data with the following SQL query depending on the build key:
SELECT * FROM VCS_BRANCH WHERE CHAIN_ID=(SELECT BUILD_ID FROM BUILD WHERE FULL_KEY='PROJ-PLAN');
The problematic data is the result with NAME that contain "initialize.chain.branches".
Delete the problematic data
Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
DELETE FROM VCS_BRANCH WHERE CHAIN_ID=(SELECT BUILD_ID FROM BUILD WHERE FULL_KEY='PROJ-PLAN') AND NAME like '%initialize.chain.branches%';
Restart Bamboo