That particular error USUALLY indicates a permission issue.
You would need to look at the failure logs to see the cause of your failure. It will be in Microsoft speak but it can lead you in the right direction. Depending on where in the install the failure occurs, the log can be in multiple places.
If no error message occurs, the following log files are created when an upgrade fails during installation before the computer restarts for the second time. You have to look at these logs to get an idea of what's causing the failure.
C:\$Windows.~BT\Sources\panther\setupact.log
C:\$Windows.~BT\Sources\panther\miglog.xml
C:\Windows\setupapi.log
[Windows 10:] C:\Windows\Logs\MoSetup\BlueBox.log
C:\Windows\inf\setupapi.app.log
C:\Windows\inf\setupapi.dev.log
C:\Windows\panther\PreGatherPnPList.log
C:\Windows\panther\PostApplyPnPList.log
C:\Windows\memory.dmp
The following log files are created when an upgrade fails, and then you restore the desktop:
C:\$Windows.~BT\Sources\panther\setupact.log
C:\$Windows.~BT\Sources\panther\miglog.xml
C:\$Windows.~BT\sources\panther\setupapi\setupapi.dev.log
C:\$Windows.~BT\sources\panther\setupapi\setupapi.app.log
C:\Windows\memory.dmp
The following log files are created when an upgrade fails, and the installation rollback is initiated:
C:\$Windows.~BT\Sources\Rollback\setupact.log
C:\$Windows.~BT\Sources\Rollback\setupact.err
Mine rolled back so I found my particular error in the last 2 logs.
If logfiles do not direct you to what caused the error, I advice anyone to not waste his time. Either stay where you are or bite the bullet, back up your data, and do a clean install. You'll thank yourself later. An upgrade failure can have you chasing your tail for days.