SQL upgrade from 2019 to 2022. Error 1639. Specified instance {My GUID} via transform: InstID02.mst;: InstName01.mst is already installed. MSINEWINSTANCE requires a new instance that is not installed.

Chris Rutherford 5 Reputation points
2025-06-30T13:29:58.4433333+00:00

Hi there,

We had a tech attempt to upgrade SQL Server from 2019 Standard to SQL Server 2022 Standard.

The upgrade initially failed with the following error:

1706. An installation package for the product Microsoft OLE DB Driver for SQL Server cannot be found. Try the installation again using a valid copy of the installation package 'msoledbsql.msi'.

This was fixed by uninstalling the existing Microsoft OLE DB driver for SQL Server as per the following link: https://learn.microsoft.com/en-us/answers/questions/1423185/sql-server-2022-developer-edition-failing-install

In the first failed upgrade Analysis Services 2022 was installed but it was marked as inactive as per the following image:

User's image

The tech then uninstalled Analysis Services 2022 via Add or Remove Programs and then attempted the upgrade again. Before the second attempted upgrade, the SQL components looked like the following (captured from the Summary log file), note no 2022 components before the second attempt:

User's image

However, the second upgrade attempt failed, the summary log file shows the following error:

Feature: Database Engine Services

Status: Failed

Reason for failure: An error occurred during the setup process of the feature.

Next Step: The upgrade process for SQL Server failed. To continue the upgrade process, use the following information to resolve the error. Next, uninstall SQL Server by using this command line: setup /q /action=uninstall /instanceid=MSSQLSERVER /features=SQLENGINE,REPLICATION,AS. Then, run SQL Server Setup again.

Component name: SQL Server Database Engine Services Instance Features

Component error code: 1639

Component log file: C:\Program Files\Microsoft SQL Server\160\Setup Bootstrap\Log\20250617_030602\sql_engine_core_inst_loc_Cpu64_1033_1.log

Error description: Invalid command line argument. Consult the Windows Installer SDK for detailed command line help.

... and the sql_engine_core_inst_loc_Cpu64_1033_1 log file shows the following error:

MSI (s) (50:F8) [03:09:43:015]: Specified instance {73F209E4-A55B-43CD-A868-33934D894976} via transform :InstID02.mst;:InstName01.mst is already installed. MSINEWINSTANCE requires a new instance that is not installed.

MSI (s) (50:F8) [03:09:43:015]: MainEngineThread is returning 1639

The crazy thing is that the GUID in the above error is associated with SQL Server 2022 Database Engine Services in the registry in the following location (plus a few others):

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\

It's like it upgrades SQL Server 2019 Database to 2022 and then complains that it's already installed. Looking at a recent summary log file where it's discovered product features on the server, it now looks like the following (note the 2022 components are there but marked as inactive):

User's image

The tech would like to uninstall all SQL Server components and then reinstall SQL Server 2022 to fix. However, that'd be quite an outage. Any ideas how this could be fixed?

It's possible that uninstalling the 2022 components before the second upgrade attempt via Add or Remove Programs didn't actually uninstall all references to SQL Server 2022 in the registry, no way I can prove that. I'm not sure if the tech followed the directions in the following URL:

https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/install/windows/remove-partial-installation#resolution

We're going to try this on a test box before doing it in PROD but if anyone has had this issue, I'd be keen to hear how you solved it =)

Kind regards,

Chris

SQL Server Database Engine
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Chris Rutherford 5 Reputation points
    2025-07-03T19:52:57.5533333+00:00

    Hi there,

    Thanks for the replies, appreciate your thoughts indeed! In the end we went with cleaning up the old SQL Server 2022 components and then we were able to successfully upgrade the SQL Server. The process we followed is below if this is helpful to anyone else in this situation.

    This is not an approved Microsoft process. To test we took a snapshot of our PROD SQL Server and stood it up on a new VM. From there we ran through the steps a couple of times to confirm that we could successfully upgrade SQL Server.

    The following steps detail the process to completely remove all SQL Server 2022 components which will allow a successful upgrade of PROD from 2019 to 2022.

    1.      Run the SQL Server 2022 Setup application as administrator, this can be found in the following location:

    C:\SQL2022\setup.exe

    2.      Using the SQL Server 2022 Setup application, perform a discovery, you should notice the following components are installed:

    User's image

    3.      Close the SQL Server 2022 Setup application.

    4.      Start the SQL Server 2022 Configuration Manager application.

    5.      Stop the SQL Server Integration Services 16.0 service.

    6.      Close the SQL Server 2022 Configuration Manager application.

    7.      Start the Services system application.

    8.      Stop the SQL Server Integration Services CEIP service 16.0 service.

    9.      Close the Services system application.

    10.      Run the Command Prompt application as Administrator.

    11.      Ensure the directory in your Command Prompt application is set to C:\Windows\System32.

    12.      Execute the following command to uninstall a SQL Server 2022 patch:

    "C:\Program Files\Microsoft SQL Server\160\Setup Bootstrap\Update Cache\KB5046861\GDR\setup.exe" /Action=RemovePatch /AllInstances

    13.      Review the KB patches at the following registry key:

    Some SQL Server 2022 patches have been installed on the SQL Server since the failed upgrade attempt.  All patches that have been installed can be found in the following folder in the registry:

    Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\

    An example of what this looks like is as per the following image:
    User's image

    It could be that additional patches may have been installed on the SQL Server since this document was written.  Review the KB patches in the registry folder mentioned above.  If there are additional patches not covered by this document, then using the UninstallString key for the patch, uninstall any additional patches.

    14.      Execute the following commands in your administrator Command Prompt to uninstall the SQL Server 2022 components:

    Note that due to the partial install, some components when uninstalling might throw an error that the action is only valid for installed products.  Just click on OK, the offending registry keys will be removed for that product.

    Note, all the commands below are specific to our system, you'll need to find out which commands you need to execute by reviewing the earlier Uninstall registry folder.

    User's image

    15.      Restart the SQL Server.

    16.      Review the following registry folder to ensure there are no SQL Server 2022 components remaining:

    Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\

    17.      Start the Windows Explorer application.

    18.      Delete the following folder: C:\Program Files\Microsoft SQL Server\160.

    19.      Restart the SQL Server.

    20.      Run the SQL Server 2022 Setup application as administrator, this can be found in the following location:

    C:\SQL2022\setup.exe

    21.      Using the SQL Server 2022 Setup application, perform a discovery, you should notice the following components are installed:
    User's image

    Note that there are no longer any SQL Server 2022 components.  You should now be fine to upgrade the SQL Server from 2019 to 2022.

    After the upgrade another discovery resulted in the following image:
    User's image

    Not sure why there are two Integration Services entries, we did select upgrade for that component but I guess it's just kept for backwards compatibility? Our other SQL boxes that were upgraded successfully without any errors have the same.

    1 person found this answer helpful.

  2. Erland Sommarskog 122K Reputation points MVP Volunteer Moderator
    2025-06-30T13:50:50.6+00:00

    A nasty situation, I would not like to be in.

    The tech would like to uninstall all SQL Server components and then reinstall SQL Server 2022 to fix. However, that'd be quite an outage.

    Well, you already have an outage, haven't you?

    I'm inclined to agree with the tech, because trying to fix this through some shortcut is likely to send you down a rabbit hole. If you are going to attempt it, open a support case with Microsoft with the highest level your support contract permits you to.

    The one caveat with the uninstall, is that the uninstall may not be clean, since the current installation seems to be messed up. This article can be of help: https://www.sql-easy.com/learn/how-to-uninstall-sql-server/.

    If this is a virtual machine, and you have a backup so that you can revert to the situation before the upgrade attempt do so. This time uninstall the driver before anything else. And, of course, run in test before you do it in prod.

    0 comments No comments

  3. RNW - Manuel Ryheul 0 Reputation points
    2025-07-03T07:30:34.73+00:00

    Hi, I fixed this after hours of searching.

    User's image

    MSINEWINSTANCE requires a new instance that is not installed.

    Get-WmiObject -Class win32_product | Where-Object {$_.Name -like "SQL Server 2022"}

    User's image

    User's image

    I had to cleanup all entries referring to {0029E33B-8F28-4225-9A4D-CDE25ABE529E}

    After that, installation succeeded succesfully.

    Hope this helps someone.

    User's image

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.