I also had the issue on a MacBook 13" M1 and Monterey 12.6 / Xcode 14. It was a nightmare, it took me two days of countless retries!
In the console log I could see it kept failing with the following message:
[ASServiceBroker]: Connection interrupted
LaunchPad:-[LPAppManager(StoreSupport) _acceptStoreConnection:]_block_invoke app store xpc message error: Connection invalid
got event: Connection interrupted
But it was not only an issue of sleep because I was using my computer while updating. I was using VSCode at the same time, which was trying to call git, not working since packaged with Xcode which is unavailable during the update...
So I stopped using the computer and did the update with the recommendations I could see on previous posts:
- plug the computer (this time I used the Apple power adapter and not the USB C cable from my external screen)
- In battery settings --> Power Adapter --> I ticked "Prevent your Mac from automatically sleeping when the display is off"
It was long but finally it worked!
I did not try caffeinate as recommended in previous post but it could be a good alternative to altering power settings.
Previously I also tried to restart the updating process (kill it, delete Xcode, restart, clear app store cache) but apart re-downloading 12gb it did not seem to help much!