For a strange reason, sometimes it can be connected to your Anti-Virus.
Maybe follow this instruction and see if it works.
A great many people are troubled by the Stardew Valley connection failed issue. How to fix the issue? This post will provide you with several effective fixes.
www.partitionwizard.com