Kernel Data Recovery Blog

DuplicateKeyException Critical Error in Exchange Server 2013

Read time 5 minutes

Exchange Server supports the creation of multiple databases and can host a large number of mailboxes. The size of mailboxes is usually in multiple GBs, and the user can meet all his communication requirements with it. The activities of mailboxes are recorded in the event log of the database. Sometimes, the Exchange database does not show any external error, but they record exceptions in the event log. These exception errors can create fault lines at different levels, and the administrators should resolve them.

‘Microsoft.Exchange.Server.Storage.Common.DuplicateKeyException: JetTableOperator.Insert’

It is the Duplicate Key Exception that is recorded in the Exchange Server 2013, and it can occur when you upgrade to Exchange Server 2019 with a cumulative update (CU) 8. The following example is an event log:

‘Event ID: 1309.’
‘Log Name: Application.’
‘Source: ASP.NET 4.0.30319.0’
‘Level: Warning.’
‘Keywords: Classic.’
‘Exception Type: DuplicateKeyException.’
‘Exception message: Cannot add a duplicate key. Use Insert instead
at Microsoft.Exchange.Security.Authentication.FederatedAuthService.CacheReader.AddEntry(String userKey, Int32 userPolicy, ConfigWrapper config).’

Cause of the error

The internal environment of the Exchange database is changed due to the cumulative update. Because these exceptions do not give any internal error, users can continue to access mailboxes and use a simple workaround to handle this exception.

Workaround

When the DuplicateKeyException error occurs, it will ask for the user credentials in Outlook. You can run a cmdlet in the Exchange Management Shell to overcome such a credential window.

‘Set-OrganizationConfig -DefaultAuthenticationPolicy $null’

Install Cumulative Update 9

The cumulative update 9 will fix all the security patches and remove the unwanted exceptions. You can get the set up at the following URL –
https://www.microsoft.com/en-us/download/details.aspx?id=102900

NOTE

After installing the update, you can restart Server and check the event log. Now, there will be no duplicate key exception.

If there are more errors coming up, it shows that there is corruption in the database, and you need to repair corrupt exchange database.

Kernel for Exchange Server

There can be numerous exceptions in the event logs that do not interfere with the mailbox health until their severity is increased. But you cannot expect to run multiple cumulative updates to remove each exception. The DuplicateKeyException occurs due to cumulative update 8. So, an update can also alter the Exchange in a negative way.

You should always have a professional Exchange database repair software available to remove corruption and recover mailboxes. Kernel for Exchange Server Recovery can remove severe corruption from an EDB file and recover its mailboxes. The following method shows that you can save the mailboxes directly to a live Exchange account-

  1. Click Add Source option or click the Offline EDB icon to connect the source EDB file.
  2. Select Offline EDB file and click Next.
  3. Click the option with three dots to browse the EDB file. After choosing the file, click Next.
  4. The scanning is complete 100%. Click Finish.
  5. In the Source section, the mailboxes of the database are recovered and accessible for preview. Now, you should click the live Exchange option in the destination section.
  6. Choose ‘Connect multiple mailboxes‘ or ‘Connect single mailbox.’ Choose Exchange Server name/IP address and Mailbox name. Click Next.
  7. Select the user mailboxes to add them to the software as a destination. Use the checkbox to choose mailboxes and click Next.
  8. In the source section, choose a mailbox, right-click and select Copy All mailboxes.
  9. Go to the destination section, right-click to the mailbox and choose to paste all mailboxes.

After the completion of the process, you can check the mailboxes in a live Exchange account.

Conclusion

The Jet errors like DuplicateKeyException cannot be fixed using tools like Eseutil. It may further delete data from the database. Kernel for Exchange Server helps to overcome many problems like corruption, large size, slow performance, accidental deletion, etc. Furthermore, the software does not require the log files to start the recovery process. There are multiple destinations for the recovered items, and you can save items in different output files like Outlook PST, live Exchange, Public Folder, and Outlook Profile.