These instructions fixed it for me: https://www.reddit.com/r/OSXBeta/comments/ddh2mj/question_osx_catalina_install_issue/f2y22co/?context=1
Though I didn't boot into recovery mode. I just opened a Terminal when logged in as usual.
First I did:
diskutil apfs list
This showed a list of all volumes, and reported an error code (I don't remember which one exactly) next to the volume described as "VM" (which seems to be the "virtual memory paging partition").
In my case, this volume was "disk1s4" but it may be different for you. I'll call it "disk1s4_changeme" below to remind you to change it to whatever it's called on your machine.
Then I ran:
diskutil apfs eraseVolume disk1s4_changeme -name VM
My understanding is that you don't risk losing any of your own data by erasing the VM partition (your data lives on another partition), but as always it's best to have backups just in case.
Then I ran
diskutil apfs list
again to check that the VM no longer reports the error code, and to verify that it's still "disk1s4".
Then
diskutil apfs chrole disk1s4_changeme V
to restore the "this is the VM volume" flag. The "V" must be uppercase! Lowercase is to remove flags.
Then
diskutil apfs list
again to make sure it's flagged as a VM. You should expect to see something like
APFS Volume Disk (Role): disk1s4 (VM)
That's it – I didn't restart my computer or anything.
I just started the Catalina installer, let it do its thing, and it succeeded. Godspeed!
xartutil --erase-all
to remove fingerprint settings on a Macbook Pro (mid-2020). It will remove the encryption keys for APFS from the disk. Your user will be unable to password authenticate and when you reinstall Catalina, you will get the above error. This recommendation resolved the issue. – Michael Dudding Jul 28 '20 at 05:54