URL-test/speed-test fails with connectex (WSAEADDRNOTAVAIL) on Windows — auto_detect_interface set unconditionally in BuildTestConfig()
Operating system
Windows
System version
Windows 10 x64
Installation type
zip
Version
1.3.0
Description
Bug: URL-test / speed-test fails with connectex WSAEADDRNOTAVAIL — root cause found in generate.cpp
Environment
- Throne: 1.3.0 (stable) — also reproduced on 1.2.4 (portable, side-by-side)
- sing-box core: v1.14.1-0.20260908150512-6d1fc214c16b
- Xray-core: 26.9.9
- OS: Windows 10/11 x64
- Network adapter: single physical Wi-Fi (Intel AX200), no other active adapters
- TUN mode OFF (
spmode_vpn = false) - Elevated (admin) and non-elevated: same result
Summary
Every URL-test / speed-test run fails with:
dial tcp <SERVER_IP>:443: connectex: The requested address is not valid in its context.
This happens for every VLESS profile tested, both with the main connection active and fully disconnected. Meanwhile, the main proxy connection itself works correctly — traffic from a real application routes through the same VLESS outbound without error.
Root cause
In src/configs/generate.cpp, the persistent (normal) route config only enables auto_detect_interface when TUN mode is on:
// line ~2126
if (settings.spmode_vpn && !route.contains("auto_detect_interface")) route["auto_detect_interface"] = true;But BuildTestConfig() (used for the URL-test / speed-test) sets it unconditionally, regardless of TUN state:
// line ~2662
QJsonObject routeObj{
{"auto_detect_interface", true},
{"default_domain_resolver", QJsonObject{
{"server", tags::dnsDirect},
{"strategy", getDirectDomainStrategy()},
}}
};With TUN off, the persistent instance never sets this flag and connects normally. The short-lived test instance always sets it, and on this system (and apparently others) sing-box's Windows auto_detect_interface binds the outbound socket to a detected "default interface" address that can be stale by the time connect() runs — matching the observed network: updated default interface log line firing right at test time, and matching the exact WSAEADDRNOTAVAIL failure mode.
What's ruled out on the system side
Confirmed via curl.exe -v https://<SERVER_IP>:443 that raw TCP + TLS handshake to the test target succeeds from the same machine. Also excluded, in order: stale/virtual network adapters, route table, NDIS-level filters bound to the adapter (WinpkFilter, Npcap, VMware Bridge), Winsock LSP catalog (clean, standard providers only), Windows Firewall rules, antivirus (disabled during testing), version regression (1.3.0 vs 1.2.4, identical), elevated vs non-elevated, connected vs disconnected main tunnel.
Suggested fix
Make the test config's auto_detect_interface conditional on the same setting the persistent config uses, e.g.:
QJsonObject routeObj{
{"default_domain_resolver", QJsonObject{
{"server", tags::dnsDirect},
{"strategy", getDirectDomainStrategy()},
}}
};
if (settings.spmode_vpn) routeObj["auto_detect_interface"] = true;Reproduction
Steps to reproduce
- Add any VLESS profile.
- Ensure TUN/System VPN mode is off.
- Run a batch URL-test or single-profile speed-test.
- Observe
connectex: The requested address is not valid in its context.for every profile tested.
Logs (sanitized)
INFO[0000] network: updated default interface <adapter>, index 20
INFO[0000] network: updated network environment: gateway <redacted>, gateway_mac <redacted>
INFO[0000] sing-box started (0.00s)
INFO[0000] outbound/vless[proxy-1-0]: outbound connection to <test-target>:443
DEBUG[0000] dns: lookup domain <proxy-domain>
DEBUG[0000] dns: exchanged A <proxy-domain>. 30 IN A <SERVER_IP>
[Info] sing-box closed in 0 ms
[<profile>] test error: Get "https://<test-target>/...": dial tcp <SERVER_IP>:443: connectex: The requested address is not valid in its context.For comparison, the same process/outbound in normal (non-test) operation, same server, succeeds without error:
INFO[0043] outbound/vless[proxy]: outbound connection to <dest_ip>:443
DEBUG[0043] dns: lookup succeed for <proxy-domain>: <SERVER_IP>
INFO[0044] outbound/vless[proxy]: outbound connection to <dest_ip>:443Source: throneproj/Throne