In order to fix it or run troubleshooting, you would need to reinstall the OS. Mostly, the issue is resolved by visiting the Mac recovery mode. It can happen when macOS seems to malfunction and can't complete the needed operations. The following are some of the common problems that force a complete reset on a Mac.
There are all kinds of reasons for us to reinstall macOS on the system. Recover Erased Files after Reinstalling Mac OS.Troubleshooting: How to Reinstall Mac OS?.