This problem is broad in scope (but not affecting every enclosure) and has existed since Big Sur. If you do searches for this, you'll find matches all over the web, including Apple's own support forums. If you do searches for this in ratings on sites like Amazon, you'll find lots of matches for all kinds of enclosures (brand) new & old.
Fans will likely soon pop in and blame cable, enclosure, firmware, settings and/or spin it like it is entirely tied to sleep and thus you need an app to prevent sleep, blah-blah-blah... but before anyone falls for any of that, I encourage them to either hook the very same enclosure through the very same cable to any older Mac (running macOS
before Big Sur) or any PC and you will likely find that it is remarkably stable.... which seems to shout where the problem lies. If you don't hear that shout, searches will lead you to stories of Mac users having a perfectly stable enclosure, upgrading macOS to a version Big Sur or newer and crashing into this problem, then downgrading again and the enclosure is stable again. Only ONE variable changes in those cases.
The best remedy while waiting for Apple to debug port management/power management (which is VERY likely the cause) is to start working through enclosure after enclosure looking for one that WILL remain connected. I did this and landed on the
OWC Ministack STX, which has been stable since it was attached. I have both an 8TB m.2 and a 18TB HDD installed in it. Meanwhile another enclosure has been temporarily "retired" since, awaiting the good news that Apple has finally got around to fixing this long-standing bug(s).
I can share much more on this topic but it's already posted in many threads expressing this same problem. I've thoroughly tested this to try to work through any possibilities and have concluded
the problem is bugs in macOS. If anyone has questions, I'm happy to answer.