web
You’re offline. This is a read only version of the page.
close
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)

I have the same question (0)
  • Suggested answer
    Marco Mels Profile Picture
    on at

    Hello,

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

    Thanks.

  • BreedX Profile Picture
    5 on at

    Thanks Marco. We are sending the support ticket.

  • Suggested answer
    Marco Mels Profile Picture
    on at

    Hello,

    Please do share final outcome if possible.

    Thanks.

  • hverheij Profile Picture
    55 on at

    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
    BreedX Profile Picture
    5 on at

    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

  • Verified answer
    hverheij Profile Picture
    55 on at

    Hi,

    Thank you for sharing this solution.

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

    Regards, Henry

  • Suggested answer
    Marco Mels Profile Picture
    on at

    Thank you for sharing final outcome with the community.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,664

#2
YUN ZHU Profile Picture

YUN ZHU 960 Super User 2025 Season 2

#3
Jainam M. Kothari Profile Picture

Jainam M. Kothari 773 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans