If it's not your hard drive and it's not your system that leaves either your user account or your connection. But that wouldn't account for trash error messages.
Have you tried repairing your usser account by
Booting up holding command-r keys into your Recovery Volume.
From the menu bar choose Utilities then select Terminal.
At the prompt type resetpassword
The Password reset utility will launch (do not reset password)
Instead, click your Mac hard drive.
Then from the drop-down select the user account you want to repair. At the bottom of the window, you’ll see an area labeled ‘Reset Home Directory Permissions and ACLs’. Click the Reset button there.
The process takes a couple of minutes. When it’s done, quit the programs you’ve opened and restart your Mac.
If it's not that then you need to go to System Preferences > Users & Groups and remove your Login Items and test. I know the problem is that it's intermittent but you'll need to run w/o them for a while or in a fresh test account to see.
The normal way to test for problems in your user would be to boot into
Safe Mode and see if the problem still occurs?
Restart holding the "shift" key.
(Expect it to take longer to start this way because it runs a directory check first.)
If this works look in System Preferences > Users & Groups > Login items and delete any third party login items (-), you can always add them back with the (+). Also look in /Library/Startup Items. Nothing is put in that folder by default, so anything in there is yours.
The reason I didn't suggest this is that you said the issues were "random" and could take some time to appear. Also there are some items that won't work in Safe Mode which may or may not get in your way in normal workflow. These are listed under "some items don't work in Safe Mode" in the link I gave you.
If you think you can work that way long enough to tell, then give it a shot.