Problem (one or two sentences)
In development mode, Zoo Code shows "Local development server is not running, HMR will not work. Please run 'npm run dev' before launching the extension to enable HMR." even though the Vite dev server is up and listening. The root cause is that localhost is ambiguous: on some systems it resolves to the IPv6 address ::1 first, while the dev server is bound to IPv4 — so requests addressed to localhost never reach it.
Context (who is affected and when)
Contributors running the extension from source in dev mode, on machines where localhost resolves to ::1 before 127.0.0.1. On affected systems, Resolve-DnsName localhost answers with AAAA first:
Name Type TTL Section IPAddress
---- ---- --- ------- ---------
localhost AAAA 1200 Question ::1
localhost A 1200 Question 127.0.0.1
Both sides of the dev loop use the name localhost: ClineProvider.getHMRHtmlContent() probes http://localhost:<port> and injects http://localhost:<port>/@react-refresh into the webview, while the Vite dev server is configured with hmr.host: "localhost". Depending on how each side resolves the name (IPv4 bind vs IPv6-first client resolution, and Node's verbatim DNS ordering), the probe connects to [::1]:<port> while nothing is listening there — the request fails, and the extension reports the dev server as not running. The issue is system-dependent (it only manifests where localhost prefers ::1), so it does not reproduce everywhere. Release builds are not affected because the webview is served from disk, not over the network.
Reproduction steps
- Windows 10/11, Node 17+ (default
--dns-result-order=verbatim), on a system where localhost resolves to ::1 first (Resolve-DnsName localhost shows the AAAA record listed above).
pnpm install, then pnpm dev (starts the Vite webview dev server on port 5173).
- Launch the extension host in development mode (F5 / the dev launch config).
- Open the Zoo Code sidebar.
- Observe: the error popup "Local development server is not running, HMR will not work..." appears even though the Vite server is running — the
await axios.get("http://localhost:5173") health check in getHMRHtmlContent() gets connection-refused because localhost resolved to [::1]:5173 while Vite serves on IPv4.
Expected result
The dev webview loads with HMR regardless of whether the system resolves localhost to ::1 or 127.0.0.1.
Actual result
The health check against http://localhost:<port> fails on IPv6-first systems, the "local dev server is not running" error is shown, and the webview falls back / stays blank even though the dev server is running.
Variations tried (optional)
- Making
localhost resolve to IPv4 first (e.g., ordering the hosts file so 127.0.0.1 localhost wins) makes the problem disappear, which confirms the resolution mismatch is the trigger.
- Using explicit
127.0.0.1 instead of localhost on both sides (dev-server host and the extension's probe/HMR URLs) fixes it deterministically.
App Version
3.82.0 (dev build, HMR mode)
API Provider (optional)
Not Applicable / Other
Model Used (optional)
N/A
Problem (one or two sentences)
In development mode, Zoo Code shows "Local development server is not running, HMR will not work. Please run 'npm run dev' before launching the extension to enable HMR." even though the Vite dev server is up and listening. The root cause is that
localhostis ambiguous: on some systems it resolves to the IPv6 address::1first, while the dev server is bound to IPv4 — so requests addressed tolocalhostnever reach it.Context (who is affected and when)
Contributors running the extension from source in dev mode, on machines where
localhostresolves to::1before127.0.0.1. On affected systems,Resolve-DnsName localhostanswers with AAAA first:Both sides of the dev loop use the name
localhost:ClineProvider.getHMRHtmlContent()probeshttp://localhost:<port>and injectshttp://localhost:<port>/@react-refreshinto the webview, while the Vite dev server is configured withhmr.host: "localhost". Depending on how each side resolves the name (IPv4 bind vs IPv6-first client resolution, and Node'sverbatimDNS ordering), the probe connects to[::1]:<port>while nothing is listening there — the request fails, and the extension reports the dev server as not running. The issue is system-dependent (it only manifests wherelocalhostprefers::1), so it does not reproduce everywhere. Release builds are not affected because the webview is served from disk, not over the network.Reproduction steps
--dns-result-order=verbatim), on a system wherelocalhostresolves to::1first (Resolve-DnsName localhostshows the AAAA record listed above).pnpm install, thenpnpm dev(starts the Vite webview dev server on port 5173).await axios.get("http://localhost:5173")health check ingetHMRHtmlContent()gets connection-refused becauselocalhostresolved to[::1]:5173while Vite serves on IPv4.Expected result
The dev webview loads with HMR regardless of whether the system resolves
localhostto::1or127.0.0.1.Actual result
The health check against
http://localhost:<port>fails on IPv6-first systems, the "local dev server is not running" error is shown, and the webview falls back / stays blank even though the dev server is running.Variations tried (optional)
localhostresolve to IPv4 first (e.g., ordering the hosts file so127.0.0.1 localhostwins) makes the problem disappear, which confirms the resolution mismatch is the trigger.127.0.0.1instead oflocalhoston both sides (dev-server host and the extension's probe/HMR URLs) fixes it deterministically.App Version
3.82.0 (dev build, HMR mode)
API Provider (optional)
Not Applicable / Other
Model Used (optional)
N/A