I've been having this issue for a few years across several different motherboards and different M2 SSDs.
After several month of a new motherboard my SSDs just "disconnect" whenever they get load giving a error saying "device which does not exist was specified" when trying to access data. After restarting the drives will appear again (however some times they do not).
The drives seem fine themselves as I can run them on other devices such as my laptop without issue and no data seems to be lossed.
Previously I thought this was a motherboard issue but this me now onto my third motherboard and this issue has popped up again after about 1.5 years of having the new motherboard.
I have a SATA SSD and HDD that work fine all the time with no issues.
Things I've tried so far:
Restarting
Reseating the SSDs
Reinstalling Windows
Reinstalling the drivers via device manager
SSDs - Samsung 970 EVO 1TBs
CPU - I7-8700k
OS - Windows 10
Any help would be greatly appreciated.