Skip to content

[Bug] ZCode 3.14.1 (Linux): model requests and OAuth login fail with ETIMEDOUT on IPv4-only networks #699

Open

Description

@pauljura

提交前确认 · Pre-submission checklist

  • 我已搜索过现有 issue,确认这不是重复 / I searched existing issues and confirmed this isn't a duplicate.
  • 我已阅读 CONTRIBUTING.md / I've read CONTRIBUTING.md.

问题类别 · Category

账号 / 登录 · Account / Login

涉及的 Agent 框架 · Agent framework

ZCode Agent(自研)

严重程度 · Severity

阻塞使用 · Blocking (无法使用核心功能 / core function unusable)

复现频率 · Reproducibility

必现 · Always

问题描述 · Description

I am using ZCode App on Linux. Upgraded to latest version 3.12.3. The 'Connect' feature does not work.

I am using a Team Plan.

Personal Plan is not subscribed.

Using API key is a workaround.

复现步骤 · Steps to reproduce

  1. Open ZCode
  2. Press 'Connect'
  3. Authenticate in browser - Success
  4. ZCode App shows "Login failed, please try again"

期望表现 · Expected behavior

Connect should work.

实际表现 · Actual behavior

Login failed, please try again

ZCode 版本 · ZCode version

3.12.3

设备 / 系统 / 浏览器 · Device / OS / Browser

Linux / Firefox

截图 / 录屏 / 日志 · Screenshots / Recordings / Logs

No response

Activity

  1. added
    status: 待评估
    type: Bug
    on Sep 17, 2026
  2. github-actions commented on Sep 17, 2026

    @github-actions

    👋 感谢你的反馈,我们已经收到。

    • 维护者看到后会尽快回复你。
    • 状态保持为 status: 待评估,你可以随时补充信息。
    • 信息不全时我们会打上 needs: 更多信息 标签并 @ 你。

    👋 Thanks — we've received your issue.

    • A maintainer will get back to you as soon as we can.
    • Status stays at status: 待评估 (Triage); feel free to add context.
    • If we need more details, we'll add needs: 更多信息 and ping you.
  3. pauljura commented on Sep 20, 2026

    @pauljura
    Author

    I updated today to v3.14.1 and this is still not working.

  4. pauljura commented on Sep 21, 2026

    @pauljura
    Author

    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.

    Repro with the shipped runtime

    ELECTRON_RUN_AS_NODE=1 /opt/ZCode/zcode -e "
    fetch('https://api.z.ai/api/paas/c1f3a7e2/v2/client',{method:'POST',signal:AbortSignal.timeout(10000)})
      .then(r=>console.log('OK',r.status))
      .catch(e=>console.log('FAIL',e.cause?.name,e.cause?.code))"
    # FAIL AggregateError ETIMEDOUT

    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.
  5. pauljura commented on Sep 22, 2026

    @pauljura
    Author

    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.

  6. isakli05 commented on Sep 24, 2026

    @isakli05

    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).

  7. 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
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

    priority: P2status: 待评估type: Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions