mySQL Database Migration fails due to "null" character in Bitbucket Server table

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

Symptoms

The following appears in Bitbucket Server 2.7.1 Migration Setup UI:

(Auto-migrated image: description temporarily unavailable)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Bitbucket Server could not be migrated to the new database. Some data may have already been written to the new database leaving it in an inconsistent state. You will need to empty or recreate the new database before trying again. com.atlassian.bitbucket.internal.maintenance.migration.DatabaseMigrationTask.run(DatabaseMigrationTask.java:44) com.atlassian.bitbucket.internal.maintenance.DefaultMaintenanceTaskMonitor.run(DefaultMaintenanceTaskMonitor.java:172) java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) ... Failed to execute change: Insert Row; nested exception is org.postgresql.util.PSQLException: ERROR: null value in column "from_branch_name" violates not-null constraint Detail: Failing row contains (1, 0, 1, 0, 2014-12-29 22:36:48.817+08, 2014-12-29 22:36:48.817+08, 1, 1, refs/heads/null, refs/heads/master, null, master, 8e33651530fffc4fa06bd912396b7e118af02df3, d88a6550790e4aff0538508675565be6ec9e97e0, null, 2). com.atlassian.bitbucket.internal.backup.liquibase.DefaultLiquibaseDao.insert(DefaultLiquibaseDao.java:281) com.atlassian.bitbucket.internal.backup.liquibase.DatabaseUpdater.endElement(DatabaseUpdater.java:81) org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source) ... ERROR: null value in column "from_branch_name" violates not-null constraint Detail: Failing row contains (1, 0, 1, 0, 2014-12-29 22:36:48.817+08, 2014-12-29 22:36:48.817+08, 1, 1, refs/heads/null, refs/heads/master, null, master, 8e33651530fffc4fa06bd912396b7e118af02df3, d88a6550790e4aff0538508675565be6ec9e97e0, null, 2). org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102) org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835) org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) ...

Diagnosis

Migrating to a clean mySQL database on Bitbucket Server 2.7.1 with the presence of the character "null" in sta_pull_request table will result in a failure of the migration that will return the error on the screenshot above.

This only have been tested on Bitbucket Server 2.7.1

Direct update to the database may cause database corruption

Resolution

  • Update to at least Bitbucket Server 2.7.6, then only perform the migration.

Updated on April 16, 2025

Still need help?

The Atlassian Community is here for you.