I had this problem with a hard drive plugged into my Pluggable TS4 dock and one TS4 cable to my M4 Max MacBook Pro. The hard drive would randomly disconnect once in a while. I plugged the hard drive directly into my MacBook and the problem went away.