Job Scheduler Search Index Error

Job Scheduler Search Index Error

This question is answered

I'm receiving the following exception when the "UserContentHandler" handler is being executed from the "Search Indexing" job.  Anyone have any idea where the duplicate value is coming from.  I'm finding this hard to troubleshoot and the index won't run until I get it fixed. 

Currently running Community 6.1.

Exception:

System.Data.SqlClient.SqlException (0x80131904): Violation of PRIMARY KEY constraint 'PK__#4106D70__737584F742EF1F80'. Cannot insert duplicate key in object 'dbo.@tbNames'.  The statement has been terminated.     at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)     at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()     at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)     at System.Data.SqlClient.SqlDataReader.SetMetaData(_SqlMetaDataSet metaData, Boolean moreInfo)     at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)     at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()     at System.Data.SqlClient.SqlDataReader.get_MetaData()     at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)     at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)     at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)     at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)     at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)     at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)     at Telligent.Evolution.AspNetMemberRole.SqlData.GetMembershipData(IList`1 userNames)     at Telligent.Evolution.AspNetMemberRole.CSMembership.GetMembershipUser(IList`1 usernames)     at Telligent.Evolution.Components.UserDataService.AddMembershipDataToUser(List`1 userList)     at Telligent.Evolution.Search.UserContentHandler...™()     at Telligent.Evolution.Search.CentralizedContentCalls.GetObjectsToIndex[T](Func`1 dataFetcher)     at Telligent.Evolution.Search.UserContentHandler.IndexDocuments(Int32 count)

Violation of PRIMARY KEY constraint 'PK__#4106D70__737584F742EF1F80'. Cannot insert duplicate key in object 'dbo.@tbNames'.  The statement has been terminated.

Verified Answer
  • That exception is being thrown from the stored procedure: cs_Membership_GetUsersByName where there appears to be a duplicate username passed into the stored procedure. Check to make sure that your site does not have users with duplicate usernames. You should not be able to create a user with a username that already exists but if it is a shared membership scenario or users were imported in some other manner then that condition could exist.

All Replies
  • That exception is being thrown from the stored procedure: cs_Membership_GetUsersByName where there appears to be a duplicate username passed into the stored procedure. Check to make sure that your site does not have users with duplicate usernames. You should not be able to create a user with a username that already exists but if it is a shared membership scenario or users were imported in some other manner then that condition could exist.

  • Thanks Dan.  This community structure has been moved around quite a bit over the years and before my time so it wouldn't surprise me if that's the case.  I'll give it a try.