Troubleshooting Visual Studio Code
This page details various issues one might have with VS Code and step-by-step instructions to address and fix them.
Web Portal Tunnel Erroring out
If your VS Code tunnel job starts, but the tunnel itself does not, you might see an error like this:

This is often caused by one of two things: either more than one tunnel is running at the same time, or a previous tunnel did not exit cleanly.
By design, VS Code only allows a single tunnel instance to exist at a time and uses a lock file, ~/.vscode/tunnel-stable.lock, to enforce this. Because your home directory is shared by all nodes, a tunnel that ended without a clean exit (for example, when the job reached its time limit or was cancelled) leaves the lock behind, and the next tunnel, usually on a different node, refuses to start.
First, make sure the tunnel job ran only one tunnel. If the job requested GPUs with -G but did not specify -N 1 -n 1, Slurm may spread it across several nodes and start one tunnel on each, and they fight over the same lock. Check with:
sacct -j <jobid> -o JobID,JobName,NNodes,NTasks
If the job used more than one node or task, request -N 1 -n 1 for the tunnel job. A tunnel does not need GPUs itself; request them only if your work in VS Code needs them.
Then, if no VS Code tunnel is running (check squeue -u $USER), remove only the stale lock:
rm -f ~/.vscode/tunnel-stable.lock
Finally, start a new job and the tunnel will start properly. Removing only the lock keeps your GitHub login, your tunnel registration, and the downloaded VS Code server, so you do not need to sign in again.
I am getting repeated Duo Auth attempts
When connecting VS Code to the supercomputer, you might find that every action--logging into a terminal, uploading a file, saving a file--all require a password input and Duo authentication.
This occurs if you are connecting directly to the login node via SSH, where the login nodes have Duo auth for required security measures.
You can prevent subsequent password prompts and authentications by creating a VS Code tunnel; this single connection allows VS Code to make any number of commands go without being interrupted by password & authentication.
If you prefer VS Code's Remote-SSH extension, or see the same prompts with scp or rsync, use SSH keys to log in without a password, or let your SSH client reuse one authenticated connection by adding this to ~/.ssh/config on your computer (macOS and Linux):
Host sol.asu.edu
ControlMaster auto
ControlPath ~/.ssh/cm-%r@%h:%p
ControlPersist 4h
Note that Remote-SSH runs the VS Code server on the shared login node; for anything more than editing files, use a tunnel on a compute node.