Jia Zheng Robert
Jia Zheng Robert

Reputation: 21

VS Code Remote Server Connection issue: Failed to download VS Code Server (Server returned 404)

While trying to use the Remote Server extention to connect to a high performance computing server, the connection was unsuccessful and returned Server returned 404.

From the error log, it appears that the error is executing the line wget [vscode-server-download-lind]. So I believe it's an issue with downloading the correct version of VS Code server.

I am able to connect through ssh. Tried different network and connecting to other high performance computing servers. Also tried manually installing vscode server, but did was all unsuccessful.

Upvotes: 0

Views: 11010

Answers (2)

Jia Zheng Robert
Jia Zheng Robert

Reputation: 21

If you do not want to just wait, like the other answer suggested, try the following approach

Resolving Visual Studio Code Server Version Issue

The issue is resolved by manually downloading the correct server version and installing it on the remote server, making sure that the obsolete version is deleted and moving the updated version to the correct location.

Step 1: Download Server File

Manually download the file in the home directory of the server using SSH from the link:

https://update.code.visualstudio.com/commit:[commit id]/server-linux-x64/stable

The commit id can be found on your local machine in the menu bar of VS Code: Code -> About Visual Studio Code -> Commit. If you are on mac, it should look something like this: b58957e67ee1e712cebf466b995adf4c5307b2bd

Use the following command to download the server file:

wget https://update.code.visualstudio.com/commit:b58957e67ee1e712cebf466b995adf4c5307b2bd/server-linux-x64/stable

Step 2: Extract and Install Server

After verifying that the download is successful, extract the vscode server by running:

tar -xvzf vscode-server.tar.gz -C ~/.vscode-server

Ensure dependencies are installed:

sudo apt-get update
sudo apt-get install libx11-dev libxkbfile-dev libsecret-1-dev

The issue in this case lies in that the vscode server files are nested incorrectly.

Navigate to the vscode server directory:

cd ~/.vscode-server/bin/<commit-hash>/
ls

If you notice a directory such as vscode-server-linux-x64 instead of expected server files like bin, extensions, etc., directly under the <commit-hash> directory, you've identified the nesting issue.

Step 3: Correct File Structure

Navigate into the incorrectly nested directory:

cd vscode-server-linux-x64/

Move all contents up one level to the correct directory:

mv * ../

Return to the correct directory and verify the structure:

cd ..
ls

You should now see the expected files and directories directly under <commit-hash>.

Step 4: Retry the Connection

After adjusting the file structure, reconnect using the Remote - SSH extension in VSCode. It should now recognize the manually installed server and not attempt to download it again.

Upvotes: 1

Michael Rodby
Michael Rodby

Reputation: 376

In my case, I had left VS Code open for several weeks without updating, so it was no longer the current version. Closing VS Code and letting it update itself, then trying again resolved the error.

Upvotes: 1

Related Questions