Fix it now
These are ordinary Windows system error codes wearing an HRESULT prefix. 0x800703F1 is ERROR_BADDB, the configuration registry database is corrupt. 0x80070091 is ERROR_DIR_NOT_EMPTY, the directory is not empty. The first is registry damage; the second is a folder setup could not clear before it rolled back.
sfc /scannow
DISM /Online /Cleanup-Image /RestoreHealth
chkdsk C: /scan
- If the code appeared during a feature update, clear the leftovers the supported way: Settings, System, Storage, Temporary files, then remove Previous Windows installation(s) and Windows Setup temporary files.
- If a folder refuses to go, take ownership and remove it:
takeown /f C:\Windows.old /a /r /d y, thenicacls C:\Windows.old /grant Administrators:F /t, thenrd /s /q C:\Windows.old. - If
chkdsk C: /scanreports problems, schedule a full pass withchkdsk C: /f /rand reboot. - Create a second local administrator account, sign in and retry the update. If it installs there, the original profile is the fault rather than Windows.
Removing the previous installation folder gives up the option of rolling back to the earlier build. If you are still inside the rollback window and might want it, resolve the failure another way first.
If the update now survives the restart, stop here. Below is what the servicing stack is failing to write, and how to tell registry damage from a failing disk.
Why it happens
Applying an update is a transaction. Windows stages the payload into the component store, writes the resulting state into the registry hives that record which components are present at which version, and commits during a restart. If any part of that write fails, the whole transaction rolls back, which is why you see the same code on every attempt rather than gradual progress.
The 0x800703Fx block is that registry write failing, and the last digit says how badly. 0x800703F1 is ERROR_BADDB, the configuration registry database is corrupt. 0x800703F2 is ERROR_BADKEY, the configuration registry key is invalid. 0x800703F7 is ERROR_REGISTRY_CORRUPT, meaning a hive’s structure is damaged. 0x800703F8 is ERROR_REGISTRY_IO_FAILED, an input or output operation initiated by the registry failed unrecoverably, and that last one points at the disk rather than at Windows.
0x80070091 is plainer than its reputation. It is ERROR_DIR_NOT_EMPTY: setup tried to delete a working folder, found something still in it and stopped. The file is usually held open by security software, or the folder contains a reparse point setup refuses to follow. 0x80070001 is ERROR_INVALID_FUNCTION, an incorrect function, which in practice means a driver or device in the path could not carry out the request at all.
Worth saying plainly, because a good deal of advice implies otherwise: none of these codes is specifically about a user profile. A damaged profile can produce update failures, and it is worth testing, but 0x80070091 says a directory was not empty and nothing more than that.
A previous installation folder cannot be removed
You have this one if 0x80070091 at the finalise stage of an upgrade, with C:\Windows.old, C:\$WINDOWS.~BT or C:\$Windows.~WS still on the disk afterwards.
- Try the supported route first: Settings, System, Storage, Temporary files, then remove the previous installation and setup temporary files.
- If the folder survives, take ownership and force it:
takeown /f C:\Windows.old /a /r /d y, thenicacls C:\Windows.old /grant Administrators:F /t, thenrd /s /q C:\Windows.old. - Repeat for the hidden setup folders, which File Explorer shows once hidden and protected operating system files are visible.
- Check for folder redirection or a junction pointing into those paths. Setup will not delete across a reparse point it does not own.
- If the folder still will not clear, repeat in Safe Mode. Security software holding files open is the usual reason, and a vendor removal tool rather than Programs and Features is what removes its filter driver.
A registry hive is damaged
You have this one if 0x800703F1, 0x800703F2 or 0x800703F7 on several unrelated updates, with sfc reporting files it could not repair.
- Run
DISM /Online /Cleanup-Image /ScanHealth, thenDISM /Online /Cleanup-Image /RestoreHealth. - If DISM cannot reach a source, mount installation media of the same edition and build and repeat with
/Source:esd:D:\sources\install.esd:1 /LimitAccess, adjusting the index and file name to match. - Follow with
sfc /scannow, reboot and retry the update. - If DISM still reports the store cannot be repaired, an in-place repair upgrade from matching media is what remains.
The disk or filesystem is failing underneath
You have this one if 0x800703F8 or 0x80070001, codes that move around between attempts, and disk warnings in the System log or a SMART alert.
- Back up first. Everything else can wait until the data is safe.
- Run
chkdsk C: /scan, thenchkdsk C: /f /rand reboot if anything is reported. - Update the storage controller driver and the drive firmware.
- Check the drive in the manufacturer’s diagnostic tool and replace it if the reallocated sector count is climbing.
The failure follows one user account
You have this one if Updates fail under one account and install cleanly under a freshly created administrator account.
- Create a new local administrator account, sign in and confirm the update installs.
- If it does, treat the original profile as the fault and move documents and application data across.
- Before that, check
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileListfor two keys with the same account identifier where one ends in.bak, which means Windows failed to load the profile and built a temporary one.
Never delete a ProfileList entry while the matching user is signed in. Windows builds a temporary profile, the desktop appears empty, and the situation looks far worse than the original fault.
Full reference
The six codes, translated
| HRESULT | Win32 code | Published name and meaning |
|---|---|---|
0x800703F1 |
1009 | ERROR_BADDB. The configuration registry database is corrupt |
0x80070091 |
145 | ERROR_DIR_NOT_EMPTY. The directory is not empty |
0x80070001 |
1 | ERROR_INVALID_FUNCTION. Incorrect function |
0x800703F2 |
1010 | ERROR_BADKEY. The configuration registry key is invalid |
0x800703F7 |
1015 | ERROR_REGISTRY_CORRUPT. The registry is corrupted; one of the files containing registry data is damaged or the in-memory image is corrupt |
0x800703F8 |
1016 | ERROR_REGISTRY_IO_FAILED. An input or output operation initiated by the registry failed unrecoverably |
The pattern is worth internalising because it generalises: an HRESULT of the form 0x8007xxxx carries a Win32 system error code in its low sixteen bits. Convert the last four hex digits to decimal and look the result up in Microsoft’s system error code list, and a code that looked like a servicing mystery turns into a plain statement about a directory, a hive or a device.
Repair command reference
| Command | What it does |
|---|---|
sfc /scannow |
Verifies protected system files and repairs them from the component store |
DISM /Online /Cleanup-Image /ScanHealth |
Reports component store damage without changing anything |
DISM /Online /Cleanup-Image /RestoreHealth |
Repairs the store from Windows Update or from a source you supply |
DISM /Online /Cleanup-Image /RestoreHealth /Source:<path> /LimitAccess |
The same repair from your own media, without consulting Windows Update |
takeown /f <path> /a /r /d y |
Gives the Administrators group ownership of a folder tree |
icacls <path> /grant Administrators:F /t |
Grants full control across that tree so it can be deleted |
chkdsk C: /scan |
Scans the volume online and reports problems without taking it offline |
Order of operations, and why it matters
sfc repairs protected files using the component store as its source. If the store itself is damaged, sfc has nothing good to copy from and will report files it could not fix. That is why DISM comes second in the sequence but is often the operation that actually resolves the problem: it repairs the store, after which sfc has something to work with. Running sfc twice is not a strategy.
An in-place repair upgrade rewrites the operating system around your data. It keeps files, applications and activation, but it cannot be reversed once started, and a machine already showing disk errors can fail part-way through and leave you worse off. Take a full backup first, and deal with the disk before the upgrade rather than after.
Telling a machine problem from an update problem
- If one machine in an estate fails and the rest install the same package, it is the machine. Start with chkdsk and DISM.
- If every machine fails on the same package on the same day, pause the deployment and check for known issues before repairing anything.
- Check the System log for disk, controller and filter driver events around the failure time.
- Check whether third-party security software is installed. Its filter driver is the most common reason a folder cannot be emptied.
- Look for reparse points under the setup folders with
dir /albefore assuming a permissions problem.
Encrypted volumes
If the volume is protected by BitLocker, have the recovery key available before you run a full chkdsk pass or start a repair upgrade. Neither operation is supposed to require it, and being locked out of a machine because the key was in a document on that machine is a bad afternoon that is entirely avoidable.
Every code this article covers
| Code | What it points at | Source |
|---|---|---|
0x800703F1 |
ERROR_BADDB (1009). The configuration registry database is corrupt, so servicing state cannot be written | Microsoft Learn |
0x80070091 |
ERROR_DIR_NOT_EMPTY (145). The directory is not empty, so setup could not remove a working folder | Microsoft Learn |
0x80070001 |
ERROR_INVALID_FUNCTION (1). Incorrect function: the device or driver could not carry out the request | Microsoft Learn |
0x800703F2 |
ERROR_BADKEY (1010). The configuration registry key is invalid | Microsoft Learn |
0x800703F7 |
ERROR_REGISTRY_CORRUPT (1015). The registry is corrupted: a file containing registry data is damaged, or the in-memory image is corrupt | Microsoft Learn |
0x800703F8 |
ERROR_REGISTRY_IO_FAILED (1016). An input or output operation initiated by the registry failed unrecoverably | Microsoft Learn |
Confirm the fix worked
DISM /Online /Cleanup-Image /ScanHealthreports no component store corruption.- The update installs and survives the restart rather than rolling back.
chkdsk C: /scancompletes with no problems found.- The previous installation and setup temporary folders are gone, and the System log shows no new disk or configuration errors.
Questions people ask about this
Will a repair upgrade cost me a new licence?
No. A repair upgrade using media of the same edition keeps your activation, and a digital licence tied to the hardware reattaches on its own. Keep the key or the Microsoft account details to hand anyway.
Is it safe to delete Windows.old?
Yes, with one caveat: it is what the rollback option uses, so once it is gone you cannot return to the previous Windows version through Settings. On a stable machine, removing it is routine and frees a lot of space.
sfc repaired files but the update still fails. What now?
Run DISM with RestoreHealth next. sfc repairs from the component store and cannot repair the store itself. If DISM says the store cannot be repaired, supply a source from matching media, and if that fails, the repair upgrade is what remains.
Does 0x80070091 mean my user profile is damaged?
No. It is ERROR_DIR_NOT_EMPTY, which says a directory setup wanted to remove still had something in it. A damaged profile can cause update failures and is worth testing with a second administrator account, but this code is not evidence of one.
Could the update itself be at fault?
Occasionally, but assume the machine first. These are local resource failures. If every machine in your estate fails on the same package on the same day, pause the deployment and check for known issues. If it is one machine, it is the machine.
