The problem occurred when I was trying to sync iCloud Drive and accidentally deleted the iCloud files from ~/Library/.
I’ve tried signing out of iCloud, rebooting, resetting NVRAM, etc. to get iCloud Drive to sync, but to no avail. I’ve recreated all iCloud folders and files by manually copying from a Monterey Time Machine backup, but to no avail. iPhoto, Calendar, Contacts, etc. all work fine in iCloud. It’s just iCloud Drive that’s broken.
Create a new user account and log in to iCloud with that account, and your iCloud Drive will be fully synced.
I really don’t want to completely reinstall macOS Sonoma and recopy the user data using Migration Assistant or Tine Machine Restore since iCloud Drive for that user account is apparently broken, and I have 2.7TB of user data so a clean reinstall and restore would take a few days after iCloud syncs everything (Photos has 500GB just of photos and videos, plus design, web, video projects, etc.).
I’m just wondering if there is a way to copy all user data (including ~/Library/ data) to the new user account, or if there is a better way to do this. Again, everything is working fine except for iCloud Drive.