cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Recon Fails with error Exception has been thrown by the target of an invocation

Good day 

Our recon has failed with the below error. Can someone please advise what the issue could be and how would we be able to resolve this.

2022-10-19 08:39:55,569 [ERROR] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'PK_ComplianceComputerContract'. Cannot insert duplicate key in object 'dbo.ComplianceComputerContract_MT'. The duplicate key value is (549, 29301617).
The statement has been terminated.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at ManageSoft.Database.DatabaseCommand.ExecuteNonQuery()
at ManageSoft.Database.Impl.DatabaseLayerBaseSql.Execute(CommandType p_CommandType, String p_CommandText, DatabaseParameter[] p_Parameters)
at ManageSoft.Compliance.Importer.Procedures.ManageSoft.LicenseReconcile.LicenseReconcileCalculate(Int32 p_LicenseMeasurementID)
at ManageSoft.Compliance.Importer.Procedures.ManageSoft.LicenseReconcile.ReconcileLicensesCalculate()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at ManageSoft.Compliance.Importer.Logic.XML.ProcedureItem.ExecuteAssembly(IExecutionContext context)
at ManageSoft.Compliance.Importer.Logic.XML.Writer.Execute(IExecutionContext context)
at ManageSoft.Compliance.Importer.Logic.ComplianceImporter.ExecuteWriters(ComplianceReader p_ComplianceReader, IExecutionContext context, String singleConnectionIdentifier)

(1) Reply
ChrisG
By Community Manager Community Manager
Community Manager

Important information giving more context about what step of the import process is being executed when this error occurred will appear in the log file immediately prior to the logging you have quoted here. Can you take a look at the prior lines of logging?

The error quoted here is a strange one to receive from an inventory import process. It suggests that something is attempting to create links between inventory device and contract records, which is not something that would normally happen during this process. Do you have any customizations configured to do extra steps during your inventory import?

(Did my reply solve the question? Click "ACCEPT AS SOLUTION" to help others find answers faster. Liked something? Click "KUDO". Anything expressed here is my own view and not necessarily that of my employer, Flexera.)