It only happens on Sonoma for us on the 16" MBP M3 Pro. Our Ventura imac is fine and we're keeping it there just as a backup system. Older 16" MBP on Catalina and then Monterey also didn't have this issue
Current workaround is to use amphetamine.app set to "indefinitely" - the drives have not disconnected with that. it's gotta be some kind of power delivery isssue.
Sent numerous feedback forms/bug reports to apple but of course it's ignored because they're too busy designing gender neutral watchbands or whatever
Amphetamine doesn't always work but I also suspect there is
some power management issue in play. The easiest catalyst to cause an Unexpected Ejection (UE) on enclosures that do it is to put the Mac to sleep and then wake it. However, that doesn't
always work.
I have tested this to death myself first hand. And among those tests is UEs while
actively transferring files to/from affected enclosures. So clearly there is no sleep on either end during those incidences. Conceptually, an active transfer is MORE awake than Amphetamine support.
My best guess is that the power-sipping nature of Silicon built upon code from iDevices is regularly working the power DOWN to maximize "battery" (even in Mac desktops with no battery) and some enclosures need a bit more power than how low that goes to maintain a connection.
HOWEVER, that can't be the only cause because of the example of "active transfer" I just referenced and
many people- including me- have tried Powered Hubs between Mac and Enclosure, which should NOT work the power level down too... unless macOS influences the power draw even through a powered enclosure middleman. I tried THREE powered enclosures and none could resolve the issue.
My guess on why Amphetamine seems to work for some is that by actively keeping the drive "awake", the power optimization macOS tries to do to save battery don't get to test their way down to the UE-triggering level. macOS assumes user might be wanting to use the drive and doesn't get to test the low. But that's just WILD GUESS on my part.
Whether powered or unpowered hub, some enclosures are affected
since Big Sur. There's abundant threads both on this site and others- including Apple's own support site- about this very thing.
And it's not (enclosure) brand based as some from the same brand will have this issue while others won't. MANY (enclosures) are NOT affected, so it's truly hit or miss. SSD-based enclosures
seem to fare better than HDD ones... and HDD RAIDS seem most likely to UE. However, even single SSD enclosures are not immune: some will have this problem and others won't. The game since Big Sur has been try different enclosures until you find one that WILL stay connected. I've got a key HDD RAID one temporarily retired right now because it won't stay connected... UNLESS I connect it to a pre-Big Sur Mac or any PC and then it is a solid as ever... including using the same cable to rule out all variables except macOS (or Silicon Mac).