Adding an SSH key fails due to "Cannot insert the value NULL into column 'KEY_TYPE'"

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

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

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_#	5

Cause

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.

Resolution

Upgrade to Bitbucket Server 4.14.0.

 

Last modified on Oct 4, 2017

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.