K2 5.2 Installer is failing with "Object Reference" error on Role in K2 Management

  • 16 February 2021
  • 0 replies
  • 14 views

Userlevel 1
Badge +8
 

K2 5.2 Installer is failing with "Object Reference" error on Role in K2 Management

kbt155711

PRODUCT
K2 Five 5.2
BASED ON
K2 Five 5.2
This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice. This article is not considered official documentation for K2 software and is provided "as is" with no warranties.

Issue

When opening the K2 Management page and navigating to the Users > Roles the error below will be displayed:

"Object reference not set to an instance of an object."

Image

 

 

Symptoms

The K2 Installer trace will be raising the error below:

"System.Data.SqlClient.SqlException: Cannot insert duplicate key row in object 'Authorization.Role' with unique index 'UX_Authorization_Role_Name'. The duplicate key value is (DomainUser).

The statement has been terminated. at Microsoft.SqlServer.Management.Common.ConnectionManager.ExecuteTSql(ExecuteTSqlAction action, Object execObject, DataSet fillDataSet, Boolean catchException) at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)"

Image

Resolution

 

 

Please note that the following steps are only applicable to K2 5.2.

To determine if there are duplicate Identity and Roles present on the upgrade environment, execute the queries below:

USE [K2]

-- Check for duplicates
SELECT * FROM [Identity].[Identity] where name in ( SELECT Name FROM [Identity].[Identity] GROUP BY name HAVING COUNT(Name) > 1 ) and type=2
--#######################################################

-- Get Identity role to migrate
SELECT [ID],[AuthorizationGuid],[Name],[DisplayName],[Identity].[GetIdentityPropertyValue]([Properties], 'Description') AS [Description]
FROM [Identity].[Identity] WHERE [Type] = 2 AND [ID] < 0
--#######################################################

-- Get Auth Roles
SELECT * FROM [Authorization].[Role]
--#######################################################

 


Under normal circumstances, no data should be displayed on the check for duplicates query.

Should the results display data, it means that are duplicate references found, which is the cause of the error in K2 Management.

Image

To resolve this issue, direct database modification will be required. Please log a K2 Support Ticket on the K2 Customer Portal for assistance with resolving the issue.

 

For more details and needed scripts, see official K2 release on https://help.k2.com/kb002869
Please Note that direct K2 database modification is not allowed as it might leave the environment in an unsupported state.
This must only be done with the assistance of, or when instructed to do so by K2 Support. Please see: http://help.k2.com/onlinehelp/k2blackpearl/devref/current/default.htm#Database_Reference.html 

 

 


0 replies

Be the first to reply!

Reply