It's caused by the client connecting to an outdated socket. To simply solve this, just SSH into the server, and kill all processes for VS code:
ps -fu $USER | grep vscode | grep -v grep | awk '{print $2}' | xargs kill
Then you can restart VS code (with remote SSH) and try again.