web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Sync-NAVTenant Error when upgrading to BC 16.2

(0) ShareShare
ReportReport
Posted on by 5

Hi Experts,

We have encountered the error below when upgrading the database from BC16.1 to BC 16.2. Previously the database is upgraded from BC15 to BC16.0, then we upgrade from BC16.0 to BC16.1 when released. We upgraded smoothly with no issue. Recently, we tried to upgrade the database to latest BC version(16.2) but hitting the error below when running this command: Sync-NAVTenant -ServerInstance BC161 -Tenant default -Mode Sync -Force

Upgrading the standard database has no issue. But hit the error when upgrading the customer database. 

Any hint for this error is much appreciated. Thank you

Here is the error taken from EventViewer:

Message (ArgumentException): RootException: ArgumentException
An item with the same key has already been added.
ExceptionStackTrace:
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Microsoft.Dynamics.Nav.Runtime.Apps.CompanionTablePrimaryKeyFixer.GetTablesGroupsWithWrongPrimaryKey()
at Microsoft.Dynamics.Nav.Runtime.Apps.CompanionTablePrimaryKeyFixer.GetCommands()
at Microsoft.Dynamics.Nav.Runtime.NavSqlTenantPropertiesSync.Upgrade(NavSqlConnectionScope conScope)
at Microsoft.Dynamics.Nav.Runtime.NavSqlTenantPropertiesSync.Sync()
at Microsoft.Dynamics.Nav.Runtime.NavSqlDatabaseSync.SynchronizeTenantDatabase(NavSession session, SynchronizationSetup syncSetup, Boolean sortingPropertiesDifferent)

I have the same question (0)
  • Suggested answer
    Marco Mels Profile Picture
    on at
    RE: Sync-NAVTenant Error when upgrading to BC 16.2

    Thank you for sharing final outcome with the community.

  • Verified answer
    hverheij Profile Picture
    55 on at
    RE: Sync-NAVTenant Error when upgrading to BC 16.2

    Hi,

    Thank you for sharing this solution.

    Dropping the $AppData tables made that I could execute Sync-NavTenant succesfully

    Regards, Henry

  • Suggested answer
    BreedX Profile Picture
    5 on at
    RE: Sync-NAVTenant Error when upgrading to BC 16.2

    Microsoft support provided the possible solutions but it does not resolved the error.

    So, we ended up analyzing the tables and debugging.

    Here are the steps we did:

    1. DELETE FROM dbo.$ndo$navappschemasnapshot WHERE [istableextension] = 1 and originalobjectid = <custom object ID range>

    2. Run Sync-NAVTenant. In our case, we still getting the error

    3. Drop all tables with $AppData. Not sure why these tables exists after converted from 15.2 to 16.1. We found these tables exists in some ways but from other databases that we converted it doesn't.

    4. Run Sync-NAVTenant again.

    We solved our issue for these steps.

    Hope this will help

  • hverheij Profile Picture
    55 on at
    RE: Sync-NAVTenant Error when upgrading to BC 16.2

    I have the same issue when upgrading from 15.2 to 16.3

    So please post the solution if you have it. Thank You

    Kind regards,

    Henry

  • Suggested answer
    Marco Mels Profile Picture
    on at
    RE: Sync-NAVTenant Error when upgrading to BC 16.2

    Hello,

    Please do share final outcome if possible.

    Thanks.

  • BreedX Profile Picture
    5 on at
    RE: Sync-NAVTenant Error when upgrading to BC 16.2

    Thanks Marco. We are sending the support ticket.

  • Suggested answer
    Marco Mels Profile Picture
    on at
    RE: Sync-NAVTenant Error when upgrading to BC 16.2

    Hello,

    I assume that it is best to raise a support ticket via your CSP.

    Thanks.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Sumit Singh Profile Picture

Sumit Singh 2,857

#2
Sohail Ahmed Profile Picture

Sohail Ahmed 2,687 Super User 2025 Season 2

#3
Jeffrey Bulanadi Profile Picture

Jeffrey Bulanadi 2,203

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans