Is there an existing issue for this bug?
Required Troubleshooting Steps
[Optional] Diagnose with Copilot
I did not ask the @remote-ssh participant for help
In step 2 of the troubleshooting wiki, what was the result of running the generated SSH command verbatim outside of VS Code?
I did not try step 2 of the troubleshooting steps
Remote-SSH Log
Remote-SSH Log
No new entries are produced when reproducing the port-forwarding hang.
Remote Server Log
Each browser/curl request to the forwarded local port produces this error on the remote server side:
2026-04-29 15:09:26.363 [error] AggregateError [ECONNREFUSED]:
at internalConnectMultiple (node:net:1134:18)
at afterConnectMultiple (node:net:1715:7)
This shows that the remote side detects the upstream ECONNREFUSED, but the already-accepted local client connection is not closed/reset promptly.
Expected Behavior
When the remote target of a VS Code forwarded port refuses the connection, VS Code should immediately close/reset the already-accepted local client socket.
Actual Behavior
VS Code accepts the local browser connection, attempts to connect to the remote target, gets ECONNREFUSED, but leaves the local client socket open/hanging. Chrome keeps waiting and can exhaust its per-host connection pool.
Steps To Reproduce
-
Connect to a remote Linux host using Remote-SSH.
-
On the remote host, make sure no process is listening on the target port. For example:
ss -ltnp | grep ':5173' || echo "nothing listening on 5173"
-
In VS Code, forward the remote port 5173 to the local machine using the Ports view.
-
From the local machine, request the forwarded local port:
curl -v http://127.0.0.1:5173/
-
Observe that the local client connection is accepted and then hangs forever.
Anything else?
This is not a general Remote-SSH connection failure. The Remote-SSH session remains connected and usable.
The issue appears to be specific to forwarded port error propagation: upstream ECONNREFUSED is detected by the remote server, but it is not propagated to the local downstream client as a close/reset.
This is especially painful in browsers. Chrome keeps the HTTP requests pending, and repeated reloads can occupy the per-host connection pool.
I understand that the local TCP handshake cannot itself return ECONNREFUSED because VS Code is listening locally. The bug is that after the upstream remote connection fails with ECONNREFUSED, VS Code does not promptly close/reset the already-accepted downstream socket.
Is there an existing issue for this bug?
Required Troubleshooting Steps
remote.SSH.useLocalServersetting[Optional] Diagnose with Copilot
I did not ask the @remote-ssh participant for help
In step 2 of the troubleshooting wiki, what was the result of running the generated SSH command verbatim outside of VS Code?
I did not try step 2 of the troubleshooting steps
Remote-SSH Log
Remote-SSH Log
Remote Server Log
Each browser/curl request to the forwarded local port produces this error on the remote server side:
This shows that the remote side detects the upstream ECONNREFUSED, but the already-accepted local client connection is not closed/reset promptly.
Expected Behavior
When the remote target of a VS Code forwarded port refuses the connection, VS Code should immediately close/reset the already-accepted local client socket.
Actual Behavior
VS Code accepts the local browser connection, attempts to connect to the remote target, gets ECONNREFUSED, but leaves the local client socket open/hanging. Chrome keeps waiting and can exhaust its per-host connection pool.
Steps To Reproduce
Connect to a remote Linux host using Remote-SSH.
On the remote host, make sure no process is listening on the target port. For example:
ss -ltnp | grep ':5173' || echo "nothing listening on 5173"
In VS Code, forward the remote port 5173 to the local machine using the Ports view.
From the local machine, request the forwarded local port:
curl -v http://127.0.0.1:5173/
Observe that the local client connection is accepted and then hangs forever.
Anything else?
This is not a general Remote-SSH connection failure. The Remote-SSH session remains connected and usable.
The issue appears to be specific to forwarded port error propagation: upstream ECONNREFUSED is detected by the remote server, but it is not propagated to the local downstream client as a close/reset.
This is especially painful in browsers. Chrome keeps the HTTP requests pending, and repeated reloads can occupy the per-host connection pool.
I understand that the local TCP handshake cannot itself return ECONNREFUSED because VS Code is listening locally. The bug is that after the upstream remote connection fails with ECONNREFUSED, VS Code does not promptly close/reset the already-accepted downstream socket.