Skip to content

[Bug]: Desktop stuck on "Connecting to WSL" — getDistroIp picks unreachable Docker bridge IP instead of eth0 #5211

Description

@9jaGuy

Summary

Desktop WSL backend hangs on "Connecting to WSL..." forever. getDistroIpImpl (apps/desktop/src/wsl/DesktopWslEnvironment.ts:691) assumes the first IPv4 in hostname -I output is always the reachable eth0 address. When Docker has created bridge networks in the distro, those sort first and are never reachable from Windows — so the app polls a dead address forever.

Environment

  • T3 Code (Alpha) 0.0.31, Windows desktop
  • WSL2 Ubuntu, networkingMode=mirrored
  • Docker running inside the distro with active bridge networks

Repro

  1. WSL2 + mirrored networking + any docker compose project running (creates a bridge network).
  2. Enable WSL backend (wslBackendEnabled/wslOnly: true) and restart T3 Code.
  3. Stuck on "Connecting to WSL..." indefinitely; restarting doesn't help, same bad IP gets picked every time.

Root cause

// apps/desktop/src/wsl/DesktopWslEnvironment.ts:691
const candidate = raw.split(/\s+/).find((part) => IPV4_PATTERN.test(part));

hostname -I returned (example): 172.22.0.1 172.19.0.1 172.17.0.1 192.168.1.219 — the first three are Docker bridge IPs (internal to the WSL VM, never reachable from Windows in any networking mode); the last is the real mirrored eth0 IP, confirmed reachable. The code takes the first match, so it grabs a Docker bridge address whenever one exists.

Confirmed the backend itself was healthy the whole time (listening on 0.0.0.0:3773, curl 127.0.0.1:3773/.well-known/t3/environment → 200 from both WSL and Windows) — this is purely an address-resolution bug, distinct from #3611.

docker network prune doesn't fix it long-term — it just makes the code pick the next Docker bridge IP in the list instead.

Suggested fix

  • Prefer 127.0.0.1 for the readiness check under mirrored networking (already works), or
  • Resolve the actual default-route interface inside WSL (ip route show default) instead of trusting hostname -I ordering.
  • At minimum, log the full candidate list and which one was chosen.

Workaround

None without tradeoffs — any Docker bridge network breaks this, and disabling wslBackendEnabled defeats the feature.

Activity

  1. 9jaGuy commented on Aug 11, 2026

    @9jaGuy
    Author

    Update: worked around this by disabling wslOnly (native-Windows backend connected reliably, no WSL bridge involved). Re-enabled wslBackendEnabled afterward and it's now also connecting fine in the parallel WSL+Windows ("mixed") backend mode — so whatever was stalling the WSL cold start on my end has since cleared.

    Separate observation worth flagging: while chasing this, I also hit cases where the WSL-hosted backend eventually did become reachable on 127.0.0.1 (confirmed via curl, and via /proc/<pid>/wchan showing it stuck in p9_client_rpc — WSL's /mnt/c/ filesystem bridge — rather than crashing), but past the 60s waitForHttpReady deadline. The desktop app never re-polled that already-spawned backend afterward and stayed on the connecting spinner until a manual restart. That's a second, independent gap from the IP-selection bug above: no retry/re-check against a backend that recovers after the readiness deadline.

  2. added a commit that references this issue on Aug 27, 2026
    d4511a2
  3. 9jaGuy commented on Sep 22, 2026

    @9jaGuy
    Author

    Closing this out — resolved on my end (T3 now connects reliably in mixed WSL+Windows backend mode). Leaving the diagnosis above in case it's useful if this resurfaces for someone else; the underlying getDistroIp IP-selection issue wasn't fixed upstream, just no longer hitting it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions