You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] ZCode 3.14.1 (Linux): model requests and OAuth login fail with ETIMEDOUT on IPv4-only networks #699
ZCode 3.14.1 (Linux): model requests and OAuth login fail with ETIMEDOUT on IPv4-only networks
Environment: ZCode 3.14.1-7714 (.deb), Electron 41 / Node v24.14.0. IPv4-only network (no IPv6 route); IPv4 TCP connect to api.z.ai CDN edges takes ~320ms.
Symptoms (all model requests + OAuth)
Every model request fails: signing handshake gets handshake-network, then the request fails with Cannot connect to API: and retries until cancelled. Worked on 3.13.x, broke immediately after updating to 3.14.1 (Sep 20).
In-app OAuth login also fails: browser auth succeeds, but the token exchange (https://zcode.z.ai/api/v1/oauth/token) returns HTTP 500 and the app shows "Login failed".
Root cause
api.z.ai resolves to 2×IPv6 + 2×IPv4. With IPv6 unreachable, Node 24's default happy-eyeballs (autoSelectFamily) kills each IPv4 attempt after ~250ms (internalConnectMultipleTimeout) — before the ~320ms connect can finish. Result: AggregateError [ETIMEDOUT] on everything. Anyone whose IPv4 path to the CDN edge exceeds ~250ms and has no working IPv6 is affected.
Same fetch succeeds with NODE_OPTIONS=--no-network-family-autoselection — but that can't be applied to the real app, because zcode-host spawns zcode-cli with a sanitized environment that strips NODE_OPTIONS.
Confirmed fix
/etc/hosts entry 127.0.0.1 api.z.ai + local socat relay on port 443 forwarding to the real CDN IP. Localhost connects complete instantly, so the timer never fires. This fixed both the model requests and the OAuth login, which suggests the OAuth flow was hitting the same connect timeout. TLS is end-to-end with the real api.z.ai certificate; the relay only forwards TCP.
Suggestions for ZCode
Pass an explicit autoSelectFamilyInitialDelay (e.g. 1–2s) to undici's connect options, or
Stop stripping NODE_OPTIONS when spawning the host/agent processes.
Follow-up with a data point: Node 26 raised the autoSelectFamilyAttemptTimeout default from 250ms to 500ms (v26.3.0 reports net.getDefaultAutoSelectFamilyAttemptTimeout() === 500), while the Node 24 runtime in ZCode 3.14.1 still has the 250ms default. My TCP connects to the api.z.ai edge take ~320ms — over the old budget, under the new one — so upgrading the bundled runtime would likely fix this outright for users on higher-latency links. If a runtime bump is further off, raising autoSelectFamilyAttemptTimeout on the API client's connections would achieve the same in the meantime.
Independent confirmation on ZCode 3.14.3 (AppImage 3.14.3.7762, CachyOS/Linux, Electron packaged / Node 24.14.0, undici 7.21.0): same signature — model.client_signing.handshake_failed (handshake-network) then ETIMEDOUT on every model request; OAuth and API-key modes both affected; zero successful model requests in the logs. Baseline: IPv4-only egress (no global IPv6, no v6 route), DNS returns 2×A + 2×AAAA, curl -4 → HTTP 200 (~1.0 s), curl -6 → instant fail; measured IPv4 TCP connect to api.z.ai ≈ 480 ms (>250 ms budget). Controlled A/B with the shipped runtime (ELECTRON_RUN_AS_NODE=1): plain fetch → ETIMEDOUT (3/3 runs, ~0.6–0.75 s); --dns-result-order=ipv4first → still ETIMEDOUT (DNS order is not the mechanism); --no-network-family-autoselection → HTTP 200 (2/2 runs). Also confirmed the packaged app rejects NODE_OPTIONS ("Most NODE_OPTIONs are not supported in packaged apps"), consistent with the sanitized spawn environment you described. +1 to the suggestions (raise autoSelectFamilyAttemptTimeout on the API client, stop stripping NODE_OPTIONS, or bump the runtime to Node 26's 500 ms default).
changed the title [-][Bug] Connect account does not work[/-][+][Bug] ZCode 3.14.1 (Linux): model requests and OAuth login fail with ETIMEDOUT on IPv4-only networks[/+]on Sep 24, 2026
Activity
github-actions commentedon Sep 17, 2026
👋 感谢你的反馈,我们已经收到。
status: 待评估,你可以随时补充信息。needs: 更多信息标签并 @ 你。👋 Thanks — we've received your issue.
status: 待评估(Triage); feel free to add context.needs: 更多信息and ping you.pauljura commentedon Sep 20, 2026
I updated today to v3.14.1 and this is still not working.
pauljura commentedon Sep 21, 2026
ZCode 3.14.1 (Linux): model requests and OAuth login fail with ETIMEDOUT on IPv4-only networks
Environment: ZCode 3.14.1-7714 (.deb), Electron 41 / Node v24.14.0. IPv4-only network (no IPv6 route); IPv4 TCP connect to api.z.ai CDN edges takes ~320ms.
Symptoms (all model requests + OAuth)
handshake-network, then the request fails withCannot connect to API:and retries until cancelled. Worked on 3.13.x, broke immediately after updating to 3.14.1 (Sep 20).https://zcode.z.ai/api/v1/oauth/token) returns HTTP 500 and the app shows "Login failed".Root cause
api.z.airesolves to 2×IPv6 + 2×IPv4. With IPv6 unreachable, Node 24's default happy-eyeballs (autoSelectFamily) kills each IPv4 attempt after ~250ms (internalConnectMultipleTimeout) — before the ~320ms connect can finish. Result:AggregateError [ETIMEDOUT]on everything. Anyone whose IPv4 path to the CDN edge exceeds ~250ms and has no working IPv6 is affected.Repro with the shipped runtime
Same fetch succeeds with
NODE_OPTIONS=--no-network-family-autoselection— but that can't be applied to the real app, becausezcode-hostspawnszcode-cliwith a sanitized environment that stripsNODE_OPTIONS.Confirmed fix
/etc/hostsentry127.0.0.1 api.z.ai+ local socat relay on port 443 forwarding to the real CDN IP. Localhost connects complete instantly, so the timer never fires. This fixed both the model requests and the OAuth login, which suggests the OAuth flow was hitting the same connect timeout. TLS is end-to-end with the real api.z.ai certificate; the relay only forwards TCP.Suggestions for ZCode
autoSelectFamilyInitialDelay(e.g. 1–2s) to undici's connect options, orNODE_OPTIONSwhen spawning the host/agent processes.pauljura commentedon Sep 22, 2026
Follow-up with a data point: Node 26 raised the
autoSelectFamilyAttemptTimeoutdefault from 250ms to 500ms (v26.3.0 reportsnet.getDefaultAutoSelectFamilyAttemptTimeout() === 500), while the Node 24 runtime in ZCode 3.14.1 still has the 250ms default. My TCP connects to the api.z.ai edge take ~320ms — over the old budget, under the new one — so upgrading the bundled runtime would likely fix this outright for users on higher-latency links. If a runtime bump is further off, raisingautoSelectFamilyAttemptTimeouton the API client's connections would achieve the same in the meantime.post-release: correct ZCode evidence — controlled network A/B, tracke…
isakli05 commentedon Sep 24, 2026
Independent confirmation on ZCode 3.14.3 (AppImage
3.14.3.7762, CachyOS/Linux, Electron packaged / Node 24.14.0, undici 7.21.0): same signature —model.client_signing.handshake_failed(handshake-network) thenETIMEDOUTon every model request; OAuth and API-key modes both affected; zero successful model requests in the logs. Baseline: IPv4-only egress (no global IPv6, no v6 route), DNS returns 2×A + 2×AAAA,curl -4→ HTTP 200 (~1.0 s),curl -6→ instant fail; measured IPv4 TCP connect to api.z.ai ≈ 480 ms (>250 ms budget). Controlled A/B with the shipped runtime (ELECTRON_RUN_AS_NODE=1): plainfetch→ ETIMEDOUT (3/3 runs, ~0.6–0.75 s);--dns-result-order=ipv4first→ still ETIMEDOUT (DNS order is not the mechanism);--no-network-family-autoselection→ HTTP 200 (2/2 runs). Also confirmed the packaged app rejectsNODE_OPTIONS("Most NODE_OPTIONs are not supported in packaged apps"), consistent with the sanitized spawn environment you described. +1 to the suggestions (raiseautoSelectFamilyAttemptTimeouton the API client, stop strippingNODE_OPTIONS, or bump the runtime to Node 26's 500 ms default).docs(backlog): close IAA-BL-002 — confirming comment posted on zai-or…
[-][Bug] Connect account does not work[/-][+][Bug] ZCode 3.14.1 (Linux): model requests and OAuth login fail with ETIMEDOUT on IPv4-only networks[/+]