Skip to content

[BUG]: Desktop task execution is unexpectedly interrupted with file watcher Invalid handle and undici terminated errors on Windows #29589

@ComradeSwarog

Description

@ComradeSwarog

Description

Description

OpenCode Desktop unexpectedly interrupts an active task execution and requires manual resume.

After resuming manually, the session context is not reset or compacted. Instead, the context continues to accumulate, which makes long-running agent work less stable and increases token usage.

This happened during normal agent usage in OpenCode Desktop on Windows with a local project directory:

W:\WorkProjects\ehr

The logs show several possibly related problems:

  1. service=file.watcher fails with Error: Invalid handle and failed to subscribe
  2. service=session.processor later fails with AbortError: Aborted
  3. service=session.processor also fails with TypeError: terminated from Node/undici TLS socket handling

Expected behavior:

  • A transient provider/network/stream interruption should either be retried automatically or surfaced as a recoverable error.
  • If the task is interrupted and resumed, OpenCode should not keep blindly accumulating context in a way that makes subsequent work heavier or unstable.
  • File watcher subscription failures on Windows should not silently destabilize the running session/task.
  • The UI should clearly explain whether the task was aborted by provider/network/file watcher/internal error.

Actual behavior:

  • The task execution stops unexpectedly.
  • I have to resume it manually.
  • The same session continues with accumulated context.
  • The error is only visible in logs.

Environment:

  • OpenCode Desktop: v1.15.11
  • Provider: Ollama Cloud
  • Subscription: Ollama Cloud Max
  • Access mode: direct API access
  • Model: DeepSeek v4 Max
  • OS: Windows 10
  • Project path: W:\WorkProjects\ehr

Relevant logs:

ERROR 2026-05-27T09:35:08 +1144ms service=file.watcher dir=W:\WorkProjects\ehr cause=Error: Invalid handle
    at FileWatcher.state (file:///C:/Users/Swarog/AppData/Local/Programs/OpenCode/resources/app.asar/out/main/chunks/node-BkOco6x4.js:66897:21)
    at FileWatcher.state (definition) (file:///C:/Users/Swarog/AppData/Local/Programs/OpenCode/resources/app.asar/out/main/chunks/node-BkOco6x4.js:268610:71)
    at FileWatcher.init (file:///C:/Users/Swarog/AppData/Local/Programs/OpenCode/resources/app.asar/out/main/chunks/node-BkOco6x4.js:334451:135)
    at FileWatcher.init (definition) (file:///C:/Users/Swarog/AppData/Local/Programs/OpenCode/resources/app.asar/out/main/chunks/node-BkOco6x4.js:268670:28)
    at InstanceBootstrap.init (file:///C:/Users/Swarog/AppData/Local/Programs/OpenCode/resources/app.asar/out/main/chunks/node-BkOco6x4.js:334451:304)
    at InstanceBootstrap (file:///C:/Users/Swarog/AppData/Local/Programs/OpenCode/resources/app.asar/out/main/chunks/node-BkOco6x4.js:334452:28)
    at InstanceStore.boot (file:///C:/Users/Swarog/AppData/Local/Programs/OpenCode/resources/app.asar/out/main/chunks/node-BkOco6x4.js:227570:28)
    at InstanceStore.load (file:///C:/Users/Swarog/AppData/Local/Programs/OpenCode/resources/app.asar/out/main/chunks/node-BkOco6x4.js:227621:31)
    at Server.listen (file:///C:/Users/Swarog/AppData/Local/Programs/OpenCode/resources/app.asar/out/main/chunks/node-BkOco6x4.js:517892:52)
    at Server.listen (definition) (file:///C:/Users/Swarog/AppData/Local/Programs/OpenCode/resources/app.asar/out/main/chunks/node-BkOco6x4.js:518015:33) failed to subscribe

ERROR 2026-05-27T13:50:37 +15328727ms service=session.processor session.id=ses_197305963ffeJN4eEY9BBNicGc messageID=msg_e69b38b80001ejhKNgmT5H03Qw error=Aborted stack=AbortError: Aborted
    at new DOMException (node:internal/per_context/domexception:76:18)
    at Array.<anonymous> (file:///C:/Users/Swarog/AppData/Local/Programs/OpenCode/resources/app.asar/out/main/chunks/node-BkOco6x4.js:303246:27)
    at Generator.next (<anonymous>)
    at ~effect/Effect/successCont (file:///C:/Users/Swarog/AppData/Local/Programs/OpenCode/resources/app.asar/out/main/chunks/node-BkOco6x4.js:7903:29)
    at ~effect/Effect/evaluate (file:///C:/Users/Swarog/AppData/Local/Programs/OpenCode/resources/app.asar/out/main/chunks/node-BkOco6x4.js:7916:25)
    at FiberImpl.runLoop (file:///C:/Users/Swarog/AppData/Local/Programs/OpenCode/resources/app.asar/out/main/chunks/node-BkOco6x4.js:7723:112)
    at FiberImpl.evaluate (file:///C:/Users/Swarog/AppData/Local/Programs/OpenCode/resources/app.asar/out/main/chunks/node-BkOco6x4.js:7693:26)
    at file:///C:/Users/Swarog/AppData/Local/Programs/OpenCode/resources/app.asar/out/main/chunks/node-BkOco6x4.js:7861:19
    at file:///C:/Users/Swarog/AppData/Local/Programs/OpenCode/resources/app.asar/out/main/chunks/node-BkOco6x4.js:6612:55
    at process.processTicksAndRejections (node:internal/process/task_queues:104:5) process

ERROR 2026-05-27T14:13:51 +1394396ms service=session.processor session.id=ses_197305963ffeJN4eEY9BBNicGc messageID=msg_e69c427c90010NKtUVds2F3YlJ error=terminated stack=TypeError: terminated
    at Fetch.onAborted (node:internal/deps/undici/undici:13602:53)
    at Fetch.emit (node:events:508:28)
    at Fetch.terminate (node:internal/deps/undici/undici:12732:14)
    at Object.onError (node:internal/deps/undici/undici:13728:38)
    at Request.onError (node:internal/deps/undici/undici:3073:31)
    at Object.errorRequest (node:internal/deps/undici/undici:1932:17)
    at TLSSocket.onHttpSocketClose (node:internal/deps/undici/undici:7726:14)
    at TLSSocket.emit (node:events:520:35)
    at node:net:346:12
    at TCP.done (node:internal/tls/wrap:671:7) process

ERROR 2026-05-27T14:26:50 +779070ms service=session.processor session.id=ses_197305963ffeJN4eEY9BBNicGc messageID=msg_e69cffeb6001CefNqBIvT4SBN4 error=terminated stack=TypeError: terminated
    at Fetch.onAborted (node:internal/deps/undici/undici:13602:53)
    at Fetch.emit (node:events:508:28)
    at Fetch.terminate (node:internal/deps/undici/undici:12732:14)
    at Object.onError (node:internal/deps/undici/undici:13728:38)
    at Request.onError (node:internal/deps/undici/undici:3073:31)
    at Object.errorRequest (node:internal/deps/undici/undici:1932:17)
    at TLSSocket.onHttpSocketClose (node:internal/deps/undici/undici:7726:14)
    at TLSSocket.emit (node:events:520:35)
    at node:net:346:12
    at TCP.done (node:internal/tls/wrap:671:7) process

Plugins

No custom plugins / default Desktop setup.

OpenCode version

OpenCode Desktop v1.15.11

Steps to reproduce

  1. Run OpenCode Desktop v1.15.11 on Windows 10.
  2. Open a project located on a Windows drive path, for example W:\WorkProjects\ehr.
  3. Configure Ollama Cloud direct API access.
  4. Use DeepSeek v4 Max with Ollama Cloud Max subscription.
  5. Start a long-running coding task.
  6. Wait until the task is interrupted unexpectedly.
  7. Resume the task manually.
  8. Observe that execution continues in the same session while context keeps accumulating.

Screenshot and/or share link

Image / screenshot section:

Image

Suggested screenshots:

  • OpenCode Desktop screen after the task is interrupted
  • The resume/manual continuation UI state
  • Logs view or exported log file showing the errors above

Operating System

Windows 10

Terminal

OpenCode Desktop on Windows.

No external terminal was used for the failed task execution.

Plugins

No response

OpenCode version

v1.15.11

Steps to reproduce

No response

Screenshot and/or share link

Image

Operating System

Windows 10

Terminal

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions