Bitbucket Server throws the error: "-1 rows were updated instead of the expected 1 row" when migrating to MS SQL Server

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

Problem

When migrating to Microsoft SQL Server, the following appears in the atlassian-bitbucket.log

1 2 3 4 5 6 7 8 "POST /admin/db/edit HTTP/1.1" liquibase Could not release lock liquibase.exception.LockException: liquibase.exception.LockException: Did not update change log lock correctly. -1 rows were updated instead of the expected 1 row using executor liquibase.executor.jvm.JdbcExecutor there are 1 rows in the table ... Caused by: liquibase.exception.LockException: Did not update change log lock correctly. -1 rows were updated instead of the expected 1 row using executor liquibase.executor.jvm.JdbcExecutor there are 1 rows in the table

Cause

NOCOUNT is set ON

Resolution

Ensure that the SET NOCOUNT option is turned off. You can do that in SQL Server Management Studio as follows:

  1. Navigate to Tools > Options > Query Execution > SQL Server > Advanced. Ensure that the SET NOCOUNT option is cleared.

  2. Now, go to the Server > Properties > Connections > Default Connections properties box and clear the no count option.

For reference:

Connecting Bitbucket Server to SQL Server

Updated on April 11, 2025

Still need help?

The Atlassian Community is here for you.