I have been hitting this error for several days now and finally came across the resolution.
I came across this very unexpected error message when my VM rebooted right after the Apply Operating System action while running a task sequence to install a custom Windows 10 image with an answer file:
Long story short, the clue to resolving this lies in the setuperr.log file in the C:\Windows\Panther\UnattendGC directory. Since I was using a VM I simply attached the .vhdx disk using Disk Management and browsed to this directory to take a look. This is what the contents of the setuperr.log looked like in my case:
[Shell Unattend] ProductKey: ‘XXXXX-XXXXX-XXXXX-XXXXX-XXXXX’ installation failed (0xc004f050)
I ended up having to remove the entire <ProductKey></ProductKey> entry from the unattend.xml answer file to resolve this problem. Simply removing the product key within the opening and closing brackets didn’t cut it. I had to remove the entire line from the answer file and add the product key to the task sequence instead (in the Apply Windows Settings step).
[windeploy.exe] Failure occured during online installation. Online installation cannot complete at this time.; hr = 0x80004005
The resolution to this one is plain weird. If you have a space in the value within the <RegisteredOrganization> </RegisteredOrganization> and <RegisteredOwner></RegisteredOwner> entries in the unattend.xml file Setup will stop in its tracks when attempting to apply the answer file after the Apply Operating System action. I ended up having to remove “Me, Myself and IT” and settling with “EMENEYE” instead.
[windeploy.exe] Setup.exe failed, returning exit code [0x1f]
This one must’ve been related to one of the above error messages since after having made the above changes to the answer file I had no other problems.
Your mileage may vary but this is the process I went through to resolving this problem. I hope someone somewhere finds this useful.