Transport endpoint is not connected (ext HDD)

Hi,
I am having a dietpi system on RPI3+ running a samba share with attached HDD.
The above message shows up sometimes and the HDD is not accessible anymore. Rebooting system fixes it, then it works for a while and than the same problem.
Any idea?
thanks

How is the HDD powered? Just by the RPi or with an own PSU?

If issue happened next time, have a look at kernel error messages bevor rebooting the system

dmesg -l err,crit,alert,emerg