Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

SQL Server update fails because the cached MSI file is missing: restoring Windows Installer cache files

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

A cumulative update, a service pack, a repair or an uninstall of SQL Server stops with a message such as: The cached MSI file 'C:\Windows\Installer\xxxxxx.msi' is missing. Microsoft's page shows the whole message, which ends: "To resolve this problem, recover the missing file from the installation media and start setup again."

The message is accurate: a file that Windows Installer needs has gone from its cache. Find out which file and which update it belongs to before you change anything. The repair and the restoration steps below do change the server, so each has a back-out.

What the error means

When a product is installed with Windows Installer, the process "stores a stripped version of the original .msi file in the cache", and each update stores its own .msp or .msi there too. The cache is %windir%\Installer. Microsoft's page says: "Any future update to the product relies on the information in the cached files. Without it, the new update can't do the required transformations."

Because SQL Server uses Windows Installer, it is affected. The page says the cached files "are unique to each computer and you can't copy them from another computer." It also names one way they go missing: "manual file deletion", which you may not notice until you update, repair or uninstall.

Likely causes

Cause What it looks like How to confirm
A cached .msi file is missing The message names C:\Windows\Installer\xxxxxx.msi and its original file, for example sql_xxxxx.msi The file is not in the folder
A cached .msp patch file is missing The message begins "The cached patch file", or setup reports "No valid sequence could be found for the set of updates. Error code 1648" The patch file named is not in the folder
Both the cache file and the original media are gone Setup logs a source file that does not exist, for example a drive letter or folder that is no longer there The folder in the Detail.txt line does not exist
Something prunes the folder repeatedly The problem returns after you restore files Third-party cleanup tools, group policies or backup agents that prune C:\Windows\Installer, which Microsoft lists as the thing to check

Prove the cause before changing anything

All of these only read.

  1. Copy the exact text of the message. Note the cached file name, the original file name and the product named. Microsoft's page shows that the original file name tells you which package to look for.
  2. Open the setup logs. For SQL Server 2016 and later, the page gives C:\Program Files\Microsoft SQL Server\<nnn>\Setup Bootstrap\Log, where <nnn> is 130 for SQL Server 2016, 140 for 2017, 150 for 2019 and 160 for 2022. In Detail.txt, lines such as Slp: Sco: File 'X:\x64\setup\x64\xxx_xxx_xxx.msi' does not exist show a missing source. In the component log, an MSI (s) line with "Source is incorrect. Unable to open or validate MSI package" also points to a missing file.
  3. For a missing patch with no clear message, Microsoft's page says to search the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches\ for the missing .msp file name to find its Patch GUID. Then search for the GUID under ...\UserData\S-1-5-18\Products\. The DisplayName value there names the update, for example a KB number. This is browsing the registry. Change nothing in it.
  4. Open C:\Windows\Installer in File Explorer and confirm the named file is really absent. Microsoft's page says Windows manages this folder and that manual changes "can cause problems", so look only.

Example (illustrative): the March cumulative update for a SQL Server 2019 instance on a hosted server stops with a message about a missing cached .msp file. The Detail.txt log names the original file. The registry search ties it to an earlier update. The same server was cleaned up with a disk tool last quarter. That matches the page's tip to check cleanup tools that prune the folder.

Fix

Microsoft orders the options. Start with the least invasive.

Option 1: repair the installation

Microsoft's page says to use the repair process before the other solutions, from the original installation media. The page does not give a way to reverse a repair, so make sure you have a current backup or checkpoint of the server first.

Risk: The next command starts a SQL Server setup repair. Microsoft's page says it repairs "the common shared components and features first", then you repeat it for each instance. If the cache file for a component is missing, the repair fails with an error rather than finishing.

setup.exe /ACTION=REPAIR /INDICATEPROGRESS=TRUE

The page says the setup dialog box disappears during the repair, and that as long as the progress window does not show an error, it is running as expected.

To undo it: a repair cannot be reversed with a command. Restore the server from the backup or checkpoint you took before it.

Option 2: the FixMissingMSI tool, or the FindSQLInstalls.vbs script

The page describes FixMissingMSI as a graphical tool that scans the cache, reports missing .msi and .msp files, and can restore them from the original media. It is downloaded from the SQLSetupTools GitHub releases page. The page also describes a script, FindSQLInstalls.vbs, that collects package information and writes Action needed lines to an output file. Both are downloaded from GitHub rather than supplied on Microsoft's page, and the page gives steps for each: install media is prepared and extracted first, using the /X option for a cumulative update or service pack, and the tool's scan reports rows whose status is Missing. Those steps are not repeated here, because each one writes files into %windir%\Installer and the page documents no undo for them. Microsoft's page notes that FixMissingMSI also works for products other than SQL Server.

The page's troubleshooting tips apply to every option: always work from a copy of the original installation media, extract cumulative updates and service packs with the /X option before you point tools at them, and run Command Prompt and PowerShell sessions as administrator, because tools that scan the %windir%\Installer folder or rewrite cached files need elevated permissions.

Option 3: restore the one missing file by hand

For one known file, Microsoft's page gives the manual route. Gather the cached file name from the message (for example 1fdb1aec.msp), find the update the original file belongs to, download it and extract it with its /x option. The page's own example extracts a hotfix package with SQLServer2008R2-KB981355-x64.exe /x C:\Temp\SQLServer2008R2-KB981355-x64\. That is an example for one old update, not a command for your server. Find the original .msp or .msi file in the extracted folder.

Before you add anything, write down the exact name of the cached file you will create and confirm it is not already in %windir%\Installer.

Risk: The next step copies a file into %windir%\Installer and renames it to the cached name. Microsoft's page warns that manual changes in this folder "can cause problems".

Copy the original .msp or .msi file into %windir%\Installer\ and rename it to the cached file name from the error message, for example from sql_engine_core_inst.msp to 1fdb1aec.msp. If the message names a missing .msi file rather than a .msp file, the page says you find the .msi on the original media you used to install the product, for example under \x64\setup\sql_engine_core_inst_msi\ for sql_engine_core_inst.msi, and skip the steps that search for, download and extract the patch package.

To undo the copy: delete only the file you added, by its exact cached name, from %windir%\Installer. It was missing before, so removing it puts the folder back as it was. This is safe only while neither the repair nor the update below has run since the copy. Once the repair or the update has used the file, it is the cached file that Windows Installer needs, so leave it in place; deleting it brings the original fault back.

Microsoft's page then says to run the SQL Server setup repair again before retrying the update, "so the cache is validated end to end". The command is the one in Option 1, run from the original installation media. The page gives no way to reverse a repair, so make sure you have a current backup or checkpoint of the server first.

Risk: The next command starts a SQL Server setup repair. It repairs the shared components and features first, and then you repeat it for each instance. If a cache file for another component is still missing, the repair fails with an error rather than finishing.

setup.exe /ACTION=REPAIR /INDICATEPROGRESS=TRUE

To undo it: a repair cannot be reversed with a command. Restore the server from the backup or checkpoint you took before Option 1 or before this step.

Risk: the next step reruns the original update, the change you set out to make; run it in the same maintenance window you planned for the first attempt. The page warns that you might receive the same message for another file of the same product, and you repeat the steps for it.

When the repair has finished without an error, start setup for the update that failed again.

Option 4: restore from a system state backup

If the other solutions fail, the page says to restore the Windows Installer cache from a system state backup, and points to its own page, "Missing Windows Installer cache requires a computer rebuild". That is a larger decision, and it needs that page's own steps.

Confirm the fix

  • The update that failed now runs through.
  • The Detail.txt log no longer shows the missing file.
  • The instance reports the new build after the update.

What to watch afterwards

  • A second missing file for another component. The page warns it can appear after the first is fixed.
  • Whatever removed the file. Check for third-party cleanup tools, group policies or backup agents, which Microsoft lists as causes of repeated cache corruption.
  • Any server that has had its Installer folder cleaned by hand.

Risks and limits

These steps have not been run or lab-tested. Microsoft's page covers SQL Server 2016 and later and older versions. Its worked examples use SQL Server 2005 to 2012 file and update names, so match your own names, not the examples. Microsoft's page directs readers to a GitHub tool and script, and no steps for them are given here. Its advice to open a support case with Microsoft for complex multi-instance servers, or when every solution fails, still stands.

Sources