It looks to be a specific error from VScode and Remote SSH extension. In some cases it worked when the time out value was increased and when the parameter useLocalServer was set to false. (remote.SSH.useLocalServer": false) under VScode settings. Also try upgrading the version for VScode and see if the issue mitigates.
To edit files and folders in the remote machine through VS-code you can Connect to a remote host.
Steps to connect to a remote host :
1. Verify you can connect to the SSH host by running the following command
ssh user@hostname
2. In VS Code select Remote SSH: Connect to host, from the Command Palette and use the same user@hostname as step 1
3. If VS Code cannot automatically detect the type of server you are connecting to you will be asked to select the type manually.
4. After a moment VS Code will connect to the SSH server and set itself up. VS Code will keep you up to date using a progress notification and you can see a detailed log in the Remote-SSH output channel.
5. After you are connected you'll be in an empty window. You can always refer to the status bar to see which host you are connected to.
6. You can then open any folder on the remote machine using File > Open. From here install any extensions you want to use when connected to the host and start editing.
Refer here for more information,