Repository navigation
[Bug]: WSL backend stuck connecting when Windows can't reach the WSL NAT IP #13738
Description
Activity
- addedbugSomething is broken or behaving incorrectly.Something is broken or behaving incorrectly.needs-triageIssue needs maintainer review and initial categorization.Issue needs maintainer review and initial categorization.
on Sep 26, 2026 Related
- [Bug]: "Connecting to WSL" infinite loading #5967 was likely this bug ("other software can access WSL, just T3 Code") but was closed for missing details. This report has the version, steps, and logs asked for there.
- [Bug]: Desktop stuck on "Connecting to WSL" — getDistroIp picks unreachable Docker bridge IP instead of eth0 #5211, fix(desktop): select the WSL route source address #5889, fix(desktop): resolve WSL distro IP from the default route, not hostname -I order #8438 fix which distro IP is chosen. Here the chosen IP is correct but unreachable, so better selection doesn't help.
- fix(desktop): verified update teardown on Windows+WSL, install integrity check, and resilient WSL readiness handshake #5998 proposed probing loopback alongside the distro addresses. It was closed for bundling several fixes, not over that idea.
- fix(desktop): honor local-only exposure in the WSL backend bind host #9066 (open) would bind the WSL backend to the distro IP only in local-only mode, which would also rule out loopback as a route on hosts like this one.
The diagnosis matches current
main(unchanged in these files since2a9832b80). In default WSL2 NAT mode,resolveWslStartConfigadvertises the distro address fromgetDistroIp(hostname -I's first IPv4, when that address is not on a Windows interface).waitForHttpReadyprobes only that URL and retries until it answers, so the WSL environment never connects and "Open WSL folder" stays hidden. The backend can still be healthy on0.0.0.0, and Windows127.0.0.1via wslhost is simply never tried.That NAT URL is deliberate. The comment in
resolveWslStartConfigrecords hosts where wslhost forwarding fails and only the distro address works. This report is the inverse: endpoint security drops the NAT address, and localhost forwarding works. It is not #5211 (wronghostname -Ientry). That selection bug is still present, but you already checked that the chosen address is the real eth0 route. #5967 was the same splash without this evidence, so this issue should stay the canonical report.#9066 does not fix this. It still advertises the NAT address, and in local-only mode it binds only that address, which removes the WSL loopback listener this host needs. #10358 would help a local-only setup by advertising
127.0.0.1, but it gives up the distro-IP fallback that other machines need.A small PR is welcome if it stays on this one behavior: keep the
0.0.0.0bind, probe127.0.0.1first, and fall back to the distro IP when loopback does not answer. The URL that succeeds has to be the one the renderer keeps using. Please include a test for each order, and leave #9056's bind-host change out of it.networkingMode=mirroredremains a working workaround because that mode already forces loopback.- addedvia-triageFiled through npx t3 triageFiled through npx t3 triageacceptedfeature request acceptedfeature request acceptedand removedneeds-triageIssue needs maintainer review and initial categorization.Issue needs maintainer review and initial categorization.
on Sep 26, 2026 Thanks @juliusmarminge made some adjustments and linked my PR above.
Let me know if any changes are necessary.
Before submitting
Area
apps/desktop
Steps to reproduce
Expected behavior
The desktop connects to the WSL backend and the WSL environment becomes usable, like VS Code/Cursor Remote-WSL on the same machine.
Actual behavior
The WSL backend process starts and is healthy, but the desktop never marks it ready.
resolveWslStartConfigsetshttpBaseUrlto the distro'shostname -IIP in NAT mode, and every readiness probe to it fails. "Open WSL folder" never appears and WSL projects can't be added.Measured from the same Windows host against the same backend:
http://<wsl-nat-ip>:3774/.well-known/t3/environmenthttp://127.0.0.1:3774/...(wslhost forwarding)http://<wsl-nat-ip>:3774/...(what the desktop uses)Routing is correct (the WSL NAT subnet routes via
vEthernet (WSL (Hyper-V firewall)), andeth0is the default route in the distro), so this isn't the wrong-interface case from #5211. The right IP is chosen but isn't reachable over HTTP from Windows.For comparison, Cursor's Remote-WSL (
anysphere.remote-wsl1.0.13) on the same machine binds its server to127.0.0.1inside WSL and always connects from Windows throughhttp://127.0.0.1:<port>, and it works.Impact
Blocks work completely
Version or commit
0.0.43-nightly.20260925.2269(also reproduced on the previous stable release); code path unchanged onmain@2a9832b80Environment
Windows 11 Enterprise, WSL2 NAT mode (no
.wslconfig), Ubuntu 24.04 distro, T3 Code desktop (dual mode: Windows primary + WSL secondary)Logs or stack traces
Screenshots, recordings, or supporting files
No response
Workaround
Switching WSL to
networkingMode=mirroredshould make the desktop use loopback, but it changes networking for every distro.I have a small fix on a branch that I can open as a PR if you want it. For WSL NAT runs it dials
127.0.0.1first, as VS Code and Cursor do, and keeps the distro IP as a readiness fallback, so hosts where wslhost forwarding is unreliable (the reason for the current behavior) still connect. It's about 60 source lines inDesktopBackendConfiguration.tsandDesktopBackendManager.ts, with focused tests, and I've verified it end to end on the affected machine.