There are 4 broad options:
1) Troubleshoot > this can take substantial time and a fix may not be found
2) Backup files to another drive or the cloud > perform a clean install
3) Perform a Windows refresh or reset > reinstall drivers and applications
4) Purchase third party software to move applications and perform a clean install
Running setupdiag may or may not provide more insight about the failure:
https://learn.microsoft.com/en-us/windows/deployment/upgrade/setupdiag
.
.
.
.
.
Please remember to vote and to mark the replies as answers if they help.
On the bottom of each post there is:
Propose as answer = answered the question
On the left side of each post there is /\ with a number: click = a helpful post
.
.
.
.
.