Skip to main content

Notifications

Announcements

No record found.

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)

  • 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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,027 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,852 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans