Skip to content
Source
Sign inSign up
pingdotgg/t3code

Desktop pairing link uses a Hyper-V vEthernet address as "Local network" on Windows #27351

OpenMedalKing(GitHub profile, opens in a new tab) opened this issue 2 comments

What happened

In the Windows desktop app, Settings → Sharing & access → Authorized clients → Create link → Local network produced a pairing link and QR code for http://172.25.80.1:3773/pair#token=…. That address belongs to vEthernet (Default Switch) (Hyper-V), which other devices on the LAN cannot reach. The machine's real LAN address is 192.168.1.147 on Wi-Fi, which holds the default route.

A second Windows machine with the same app version and the same kinds of adapters produced a correct link (192.168.1.140 on Ethernet), only because Windows happens to list its adapters in a different order.

Diagnosis

The pairing host comes from resolveLanAdvertisedHost in apps/desktop/src/backend/DesktopServerExposure.ts. It takes the first private IPv4 address, in os.networkInterfaces() order, whose interface name does not match HOST_ONLY_INTERFACE:

const HOST_ONLY_INTERFACE =
  /^(bridge\d|utun|ipsec|ppp|tun|tap|wg|docker|br-|veth|virbr|vmnet|vboxnet|VirtualBox|VMware)/;

vEthernet is missing, so Hyper-V/WSL adapters are treated as real LAN adapters and the result depends on Windows' adapter enumeration order. The server-side VIRTUAL_INTERFACE in apps/server/src/environment/DirectEndpoints.ts already includes vEthernet, so the two filters have drifted apart. Checked against v0.1.5 and main; both have the same regex and selection logic.

Suggested fix: add vEthernet to HOST_ONLY_INTERFACE, or share one virtual-adapter filter between DirectEndpoints.ts and DesktopServerExposure.ts. Preferring the interface that holds the default route (as #17788 suggested) would also cover renamed or localized adapter names.

Steps to reproduce

Deterministic, in apps/desktop/src/backend/DesktopServerExposure.test.ts: the existing case "advertises the Wi-Fi or Ethernet address ahead of bridges and tunnels", with Windows interface names in the affected machine's order:

{
  "vEthernet (Default Switch)": [{ address: "172.25.80.1", family: "IPv4", internal: false }],
  "vEthernet (WSL (Hyper-V firewall))": [{ address: "172.24.144.1", family: "IPv4", internal: false }],
  "Wi-Fi": [{ address: "192.168.1.147", family: "IPv4", internal: false }],
}

Expected advertisedHost is 192.168.1.147; by the regex above it is 172.25.80.1 (derived from the code, not run).

On a real machine:

  1. On Windows 11 with Hyper-V or WSL2 enabled, have a vEthernet (...) adapter listed before the physical adapter in os.networkInterfaces().
  2. In the T3 Code desktop app, turn on Settings → Sharing & access → Network access.
  3. Under Authorized clients, click Create link and choose Local network.
  4. The link and QR code use the vEthernet address instead of the physical adapter's. Opening it from another device on the LAN fails.

Reproduces every time on the affected machine.

Version

0.1.5 (desktop app, Beta channel; serverVersion 0.1.5 from /.well-known/t3/environment on both machines)

Environment

Windows 11 Pro 10.0.26300 on both machines; Hyper-V/WSL2 adapters present; Tailscale; NordVPN installed (inactive). Local server, paired from another device.

Evidence

# IPv4 addresses in os.networkInterfaces() order (Node 26.13.0 on both machines; link-local omitted)

# Affected machine: link uses 172.25.80.1
Tailscale                           100.x.x.x       (skipped as Tailscale)
vEthernet (Default Switch)          172.25.80.1     <- picked
vEthernet (WSL (Hyper-V firewall))  172.24.144.1
Wi-Fi                               192.168.1.147   (default route)
Loopback Pseudo-Interface 1         127.0.0.1

# Second machine: link uses 192.168.1.140 (correct by ordering luck)
Tailscale                           100.x.x.x       (skipped as Tailscale)
Ethernet                            192.168.1.140   <- picked (default route)
Loopback Pseudo-Interface 1         127.0.0.1
vEthernet (Default Switch)          172.30.16.1
vEthernet (WSL (Hyper-V firewall))  172.22.48.1
  • #17788 (closed): the same function picked an idle macOS bridge. Its fix, #18085, added names to HOST_ONLY_INTERFACE but not vEthernet, and did not add the default-route preference.
  • #17246, PRs #25991 and #21056: change only the server's DirectEndpoints.ts (learned routes), not the desktop pairing link.
  • PR #24474: stale addresses after a network change, not adapter choice.
  • #7519 (closed): Tailscale address chosen for Local network.

Fix applied or workaround

Nothing changed on either machine. Workaround: replace the host in the pairing link by hand with the physical adapter's address. The server binds 0.0.0.0 and the Windows firewall allows T3 Code on Private networks, so pairing succeeds with the edited link.

Filed by

Claude Code (Claude Opus 5.5), following the triage playbook.

  1. [GPT-6.1 Sol][Codex] on behalf of shivam.

    Issue watch found Julius already owns this fix in https://github.com/pingdotgg/t3code/pull/27360 at head 49b96ebc326e4bfeec40f01ee513774580c454f1. The desktop filter on main at 8b44f42b14c8e273156474a924ccf29680dd7857 still omits vEthernet; that PR adds it and covers the reported Windows adapter order. Handing off to that PR without a competing branch. I did not run Windows or desktop verification in this thread.

  2. tanstack-source added labelsbug

  3. Another Windows 11 repro on desktop 0.1.11 (Beta), same root cause but a different address range and adapter order than the report.

    Settings -> Sharing & access shows Local network as http://172.29.176.1:3773/ and marks it as the default, while the server is bound to 0.0.0.0:3773 and 192.168.50.160:3773 (the physical adapter) is the address other devices can actually reach.

    os.networkInterfaces() order on the affected machine (Node v24.20.0):

    Tailscale                           100.122.207.32    (skipped as Tailscale)
    vEthernet (Default Switch)          172.29.176.1      <- picked
    以太网 (Realtek 2.5GbE)              192.168.50.160    (default route)
    Loopback Pseudo-Interface 1         127.0.0.1         (internal)
    • HOST_ONLY_INTERFACE.test("vEthernet (Default Switch)") is false (checked directly): the pattern is case-sensitive and contains veth, which does not match vEth..., and vEthernet is not listed at all.
    • The physical adapter is named 以太网 here, so this machine also shows why matching on interface names is brittle on non-English Windows: no name list can cover localized adapter names. Preferring the interface that holds the default route would fix this case and the renamed-adapter case at once.
    • WSL is running in mirrored networking mode on this machine (its default route is the LAN gateway, DNS is 10.255.255.254), so the Hyper-V adapter is not even carrying WSL traffic; it exists only for Hyper-V/container NAT.
    • Workaround that works: T3CODE_DESKTOP_LAN_HOST=192.168.50.160 before launching the desktop app, so the override path already behaves correctly.

Sign in to join this conversation.