"Name is null" error after restoring Bamboo from backup
Platform Notice: Data Center Only - This article only applies to Atlassian apps 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
Problem
After restoring Bamboo from a backup or database dump, one or more Bitbucket Cloud repositories stop working.
Bamboo 11.0 and later: Bamboo starts normally, but opening the repository's configuration page shows an error.
Bamboo 10.x and earlier: Bamboo can fail to start, or pages fail with a 500 error.
These errors appear in <bamboo-home>/logs/atlassian-bamboo.log:
Bamboo 11.0 and later – opening the repository configuration page:
ERROR [http-nio-8085-exec-20 url: /bamboo/admin/editLinkedRepository.action; user: admin] [ExceptionMappingInterceptor] Name is null java.lang.NullPointerException: Name is null at java.base/java.lang.Enum.valueOf(Enum.java:291) at com.atlassian.bamboo.plugins.bitbucket.BitbucketAccessLevel.valueOf(BitbucketAccessLevel.java:11) at com.atlassian.bamboo.plugins.bitbucket.v2.configurator.BitbucketCloudServerConfigurator.populateCredentialsSelection(BitbucketCloudServerConfigurator.java:194) at com.atlassian.bamboo.plugins.bitbucket.v2.configurator.BitbucketCloudServerConfigurator.populateContextForEdit(BitbucketCloudServerConfigurator.java:156) at com.atlassian.bamboo.configuration.repository.VcsUIConfigBean.prepareEditHtmlFragments(VcsUIConfigBean.java:154) ...Bamboo 10.x and earlier
io.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.NullPointerException: Name is null ... Caused by: java.lang.NullPointerException: Name is null at java.lang.Enum.valueOf(Enum.java:236) at com.atlassian.bamboo.plugins.bitbucket.BitbucketAccessLevel.valueOf(BitbucketAccessLevel.java:11) at com.atlassian.bamboo.plugins.bitbucket.BitbucketRepository.populateFromConfig(BitbucketRepository.java:309) at com.atlassian.bamboo.vcs.configuration.legacy.configurator.LegacyBranchConfigurator.getVcsBranchFromRepositoryXml(LegacyBranchConfigurator.java:88) ...
Environment
Bamboo Data Center 9.6 and later, using Bitbucket Cloud repositories (linked or plan-level).
Diagnosis
Run this query to find Bitbucket Cloud repositories that are missing the access level setting (tested on PostgreSQL):
SELECT VCS_LOCATION_ID, NAME, IS_GLOBAL
FROM VCS_LOCATION
WHERE PLUGIN_KEY = 'com.atlassian.bamboo.plugins.atlassian-bamboo-plugin-bitbucket:bbCloud'
AND XML_DEFINITION_DATA NOT LIKE '%repository.bitbucket.accessLevel%';Each row returned is an affected repository. IS_GLOBAL = true means it is a linked repository.
Cause
Bamboo stores each Bitbucket Cloud repository's access level (for example, PRIVATE) in the repository.bitbucket.accessLevel setting. When that setting is missing, Bamboo cannot load the repository's configuration and throws NullPointerException: Name is null. This most commonly happens when the restored database doesn't match the <bamboo-home> directory. For example:
The database and the home directory come from different backups or different Bamboo versions.
Bamboo was started, and its upgrade ran, before the database was restored.
Resolution
If you have a backup of <bamboo-home> and the Bamboo database taken at the same time:
Shut down Bamboo.
Restore <bamboo-home> from the backup.
Restore the database from the same backup.
Start Bamboo. If the backup is from an older version, Bamboo runs the upgrade again.
Open the affected repository's configuration page and run a plan that uses it to confirm the error is gone.
Note: Bamboo caches repository configuration in memory, so any database change needs a Bamboo restart to take effect.
Was this helpful?