Adding an SSH key fails due to "Cannot insert the value NULL into column 'KEY_TYPE'"
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
Summary
Problem
Attempting to add an SSH key fails.
The following appears in the atlassian-bitbucket.log:
# The following example is from a Microsoft SQL Server database
com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert the value NULL into column 'KEY_TYPE', table '<Bitbucket database>.AO_FB71B4_SSH_PUBLIC_KEY'; column does not allow nulls. INSERT fails.
at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.create(EntityManagedActiveObjects.java:102) ~[na:na]
...
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert the value NULL into column 'KEY_TYPE', table 'Bitbucket.dbo.AO_FB71B4_SSH_PUBLIC_KEY'; column does not allow nulls. INSERT fails.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:217) ~[sqljdbc-6.0.7507.jar:na]Diagnosis
Diagnostic Steps
Check the content of the global.settings table:
select * from global.settings;This issue occurs when the version of the AO_FB71B4_ table (the one used for storing the SSH keys) is 5 (or higher) but the Bitbucket Server version is lower 4.14.0.
bitbucket.global.settings AO_FB71B4_# 5Cause
The KEY_TYPE column has been added as part of a database upgrade that did not complete successfully.
This column is only expected when running Bitbucket Server 4.14.0 or higher.
Solution
Resolution
Upgrade to Bitbucket Server 4.14.0.
Was this helpful?