Adding an SSH key fails due to "Cannot insert the value NULL into column 'KEY_TYPE'"
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
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.
*Fisheye および Crucible は除く
問題
Attempting to add an SSH key fails.
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]
診断
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_# 5
原因
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.
ソリューション
Upgrade to Bitbucket Server 4.14.0.