GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ECONNRESET: The socket connection was closed unexpectedly. For more information · Issue #59291 · anomalyco/opencode

ECONNRESET: The socket connection was closed unexpectedly. For more information #59291

New issue
Copy link
New issue
Copy link
Closed
Closed
ECONNRESET: The socket connection was closed unexpectedly. For more information#59291
Copy link
Labels
triaging

Description

@kharitonovdo
kharitonovdo
opened on Oct 26, 2026
Issue body actions

This error happens quite often. I don’t understand why, or how to fix it. My internet connection is excellent, and it’s definitely not a hardware issue.

Reacted by Vladis, Salva Alcántara, Ray Tian and Gabriela

Activity

  1. opencode-agent commented on Oct 26, 2026

    @opencode-agent
    opencode-agentBot
    on Oct 26, 2026 – with OpenCode Agent
    Contributor
    More actions

    Thanks for the report! This error can come from several different causes, so we need a few details to work out which one you're hitting:

    1. OpenCode version (opencode --version), your OS, and how you installed OpenCode.
    2. Where you see the error: the TUI, the desktop app, opencode run, or a third-party front end. Please paste the full error text or a screenshot.
    3. Provider and model you're using (e.g. OpenCode Zen/Go, Anthropic, OpenAI, or a custom/OpenAI-compatible endpoint).
    4. When it happens: on the first message after OpenCode has been idle for a while, partway through a long response or tool call, after a fixed amount of time, or only in one large session.
    5. Any proxy, VPN, firewall or security/antivirus software (e.g. Zscaler, CrowdStrike) on your machine or network.
    6. If possible, the logs from a run where it happens (start OpenCode with --print-logs, or attach the log file).

    You can reply here with the details, or edit the issue. If you edit it, please also leave a comment saying you've updated it, so we know you're done.

    These existing issues may already cover your problem. They're ordered by likelihood:

    • TUI client fails with socket closed error on stale keep-alive connections #54160: the TUI fails with "socket connection was closed unexpectedly" when it reuses idle keep-alive connections, especially behind proxies or security agents (fix(client): add transparent retry for socket/ECONNRESET errors #54154 is an open PR that adds automatic retries for this)
    • Constant ECONNRESET error #57875: constant ECONNRESET on 2.0.32 across several providers and models
    • ECONNRESET: The socket connection was closed unexpectedly. For more information, pass verbose: true in the second argument to fetch() #53829: ECONNRESET in one large session with many images and tool calls; forking the session and compacting it fixed it
    • ai(google-vertex): ECONNRESET after exactly 60.0s during large tool calls (streamFunctionCallArguments not enabled) #56344: ECONNRESET after exactly 60s during large tool calls with Google Vertex
    • ECONNRESET when using Custom Provider: socket connection closed unexpectedly and custom server not detected correctly #51537: ECONNRESET with a custom provider
    Reacted by Vladis and RickRosten
  2. opencode-agent
    added
    triaging
    on Oct 26, 2026
  3. kharitonovdo commented on Oct 26, 2026

    @kharitonovdo
    kharitonovdo
    on Oct 26, 2026
    Author
    More actions
    Image ECONNRESET: The socket connection was closed unexpectedly. For more information, pass `verbose: true` in the second argument to fetch()

    When a task is complex and the neural network takes a long time to process it, this error occurs. How can I fix it?

    Reacted by Vladis and RickRosten
  4. opencodejr commented on Oct 28, 2026

    @opencodejr
    opencodejrBot
    on Oct 28, 2026
    Contributor
    More actions

    Thanks for the error text and the screenshot, and for noting that it happens when a task is complex and the model takes a long time to answer. That helps narrow it down.

    We still need a few details to work out which cause you're hitting, because this error has several:

    1. OpenCode version (opencode --version), your operating system, and how you installed OpenCode.
    2. Where you use it: the TUI, the desktop app, opencode run, or another front end.
    3. Provider and model (e.g. OpenCode Zen/Go, Anthropic, OpenAI, Google Vertex/AI Studio, or a custom/OpenAI-compatible endpoint).
    4. Roughly how long the model has been working when the error appears. For example, is it always about 60 seconds, or does it vary? Does it happen while the model is writing a large file or edit?
    5. Any proxy, VPN, firewall or antivirus/security software on your machine or network.
    6. If possible, logs from a run where it happens (start OpenCode with --print-logs, or attach the log file).

    You can reply here with the details, or edit the issue. If you edit it, please also leave a comment saying you've updated it, so we know you're done.

    These existing issues may already cover your problem. They're ordered by likelihood:

    • ai(google-vertex): ECONNRESET after exactly 60.0s during large tool calls (streamFunctionCallArguments not enabled) #56344: ECONNRESET after exactly 60s while the model generates a large tool call (Google Vertex)
    • Constant ECONNRESET error #57875: repeated ECONNRESET on longer prompts and tasks across several providers
    • TUI client fails with socket closed error on stale keep-alive connections #54160: socket closed on reused idle keep-alive connections, especially behind proxies or security software (fix(client): add transparent retry for socket/ECONNRESET errors #54154 is an open PR that adds retries for this)
    • Intermittent EPROTO TLS handshake / ECONNRESET on provider streaming calls - suspected stale keep-alive reuse after idle (Windows, togetherai) #59786: intermittent ECONNRESET on provider streaming calls after an idle period (Windows, TogetherAI)
    • ECONNRESET: The socket connection was closed unexpectedly. For more information, pass verbose: true in the second argument to fetch() #53829: ECONNRESET in one very large session; forking it and compacting it fixed it
  5. magusy commented on Oct 31, 2026

    @magusy
    magusy
    on Oct 31, 2026
    More actions

    Following up with diagnostics from a machine that hits this regularly.

    Environment

    • OpenCode 2.2.4, desktop app for Windows (per-user install at %LOCALAPPDATA%\Programs\ai.opencode.desktop\OpenCode.exe)
    • CLI @opencode/[email protected] (npm global), so client and server versions match
    • Windows 11 Pro 21H2, 10.0.22000, x64
    • Error appears in the desktop app. The bundled background service logs it server-side in %USERPROFILE%\.local\share\opencode\log\opencode.log; there is no external proxy in front of it.

    Error text

    timestamp=2026-10-30T22:21:20.916Z level=ERROR run=<id> message="Failed to drain Session"
    cause="AI.Error: ECONNRESET: The socket connection was closed unexpectedly. For more information, pass `verbose: true` in the second argument to fetch()
        at a (B:/~BUN/root/chunk-fgtjesq4.js:6:4214)
        at <anonymous> (B:/~BUN/root/chunk-4e2rqd16.js:18:6047)
        at runLoop (B:/~BUN/root/chunk-4e2rqd16.js:18:2552)
        ...
        at SessionStep.attempt (B:/~BUN/root/chunk-z20sjgqk.js:382:3574)
        at SessionRunner.runStep (B:/~BUN/root/chunk-z20sjgqk.js:382:2672)
        at SessionRunner.drain (B:/~BUN/root/chunk-4e2rqd16.js:18:2552)
        at ServerProcess.start (B:/~BUN/root/chunk-94gxrctf.js:2:7603)
      [cause]: AI.Error.Transport: ECONNRESET: The socket connection was closed unexpectedly. ...
        [cause]: TypeError: The socket connection was closed unexpectedly. ...
    } role=server sessionID=ses_...
    

    Stack trimmed for brevity; the wrapper is always Failed to drain Session, with AI.Error.Transport: ECONNRESET underneath.

    Frequency

    43 events in the current log (15.8 MB, covering 2026-09-07 04:41Z to 2026-10-31 00:56Z), all in bursts:

    UTC hour events
    2026-09-07 04 1
    2026-10-24 15 2
    2026-10-24 18 2
    2026-10-29 20 1
    2026-10-30 19 4
    2026-10-30 20 10
    2026-10-30 21 6
    2026-10-30 22 7
    2026-10-30 23 9
    2026-10-31 00 1

    37 of them fall between 2026-10-30 19:25Z and 2026-10-31 00:56Z. Gaps are irregular: from 0.2 to 103 minutes. The tightest cluster is 22:59:25Z-23:13:15Z — 12 resets in 14 minutes, sometimes 11-21 seconds apart. So this does not look like a keep-alive or idle timeout on a fixed schedule.

    When it happens

    During long streaming turns, especially tool-heavy ones with slow commands, but also on turns where the only long-lived stream is the model response itself. Short prompts do not reproduce it.

    Provider / model

    Per-event attribution is not available in the log: sessions that reset only appear in the ERROR lines, without a matching message=stream providerID=... line. Models used on this machine in the same period: opencode/big-pickle (8099 streams), opencode/hy3-free (1137), ollama/gemma4:31b-cloud (160). Providers: opencode and ollama.

    Network

    No proxy, VPN, or TLS-inspecting security product on the machine. The ISP does intermittently interfere with TLS handshakes to some domains, so a middlebox dropping long-lived connections is plausible — but the resets also happen on turns where the only long-lived stream is the model response itself.

    Impact

    Non-fatal: session state survives, but the turn aborts and has to be re-sent manually. 37 resets in one 5.5-hour session is disruptive.

    Suggestion

    #54154 (retry with backoff for transport errors) would cover most of this. Retrying idempotent streaming requests, or resuming from the last received chunk, would remove the manual step entirely.

    Happy to test a build with the retry patch.

  6. opencodejr
    closed this as not plannedon Oct 31, 2026
  7. opencodejr commented on Oct 31, 2026

    @opencodejr
    opencodejrBot
    on Oct 31, 2026
    Contributor
    More actions

    We're closing this for now because we haven't heard back with the details we asked for: your OpenCode version, OS and install method, where you use it (TUI, desktop app or opencode run), the provider and model, and any proxy/VPN/security software or --print-logs output. This error has several possible causes, and we need those details to tell which one you're hitting.

    If it still happens, please reply with those details, or open a new issue that includes them, and we'll take another look. In the meantime, #56344, #57875 and #54160 may cover your problem, so they're worth following.

  8. opencodejr
    reopened this on Nov 3, 2026
  9. omandotkom commented on Nov 10, 2026

    @omandotkom
    omandotkom
    on Nov 10, 2026
    More actions

    stupid harness. Retrying in 2s · attempt 3 · ECONNRESET: The socket connection was closed unexpectedly. For more information, pass verbose: true in the second argument to fetch()

  10. thanhchuongbmd commented on Nov 11, 2026

    @thanhchuongbmd
    thanhchuongbmd
    on Nov 11, 2026
    More actions

    Retry due · attempt 3 · ECONNRESET: The socket connection was closed unexpectedly. For more information, pass verbose: true in the second argument to fetch()
    I so

  11. neriousy commented on Nov 12, 2026

    @neriousy
    neriousy
    on Nov 12, 2026
    Member
    More actions

    This should be fixed in the latest version. If you still see ECONNRESET after updating, please open a new issue with your opencode --version, OS, provider/model and any logs.

  12. neriousy
    closed this as completedon Nov 12, 2026
  13. thanhchuongbmd commented on Nov 13, 2026

    @thanhchuongbmd
    thanhchuongbmd
    on Nov 13, 2026
    More actions

    This should be fixed in the latest version. If you still see ECONNRESET after updating, please open a new issue with your opencode --version, OS, provider/model and any logs.

    still error and response token very slow (~5 token /s), version: v2.2.7

  14. thanhchuongbmd commented on Nov 18, 2026

    @thanhchuongbmd
    thanhchuongbmd
    on Nov 18, 2026
    More actions

    This should be fixed in the latest version. If you still see ECONNRESET after updating, please open a new issue with your opencode --version, OS, provider/model and any logs.

    Screenshot 2026-11-18 at 21 35 12 Screenshot 2026-11-18 at 21 26 40 Screenshot 2026-11-18 at 21 26 51

    call tool take 200s, 171s, 226s, 175s
    OS: MacOS 15.x, chip M1
    Model: Any on OpenCode Go => I try z.ai is very fast
    A task run in 15m => very slow, current effort is low, and the task is very easy

  15. NerdyShawn commented on Nov 26, 2026

    @NerdyShawn
    NerdyShawn
    on Nov 26, 2026
    More actions

    Fresh data point on v2.4.1 (service, Linux, opencode-go/qwen3.8-flash): resets arriving before the first token terminate the turn with an empty message and no retry lines in the log — so the Nov 12 'fixed in latest' does not cover this path. Details and evidence in #66681.

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

    triaging

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.