I encountered this problem many times, and I found today that it's caused by lack of disk space.
In my machine there is more than 7GB spare space, and after downloading the files, it reported this error.
Today I find the real problem from /private/var/log/install.log
, it is caused by low disk space, so I made more space, and the update succeeded.
Since the download is 6 GB you'll want to delete old versions and have at least 15 GB free space before trying again to download. Look in /var/folders for paused / stuck downloads as well as perhaps cleaning any local time machine snapshots once you delete a large app like Xcode. Even after emptying trash, it will consume space for a few days or longer if you don't regularly have a Time Machine volume attached to let the snapshots age out.