Bug: AbortSignal.timeout is not a function #4817

Open
opened 2026-02-16 17:45:33 -05:00 by yindo · 0 comments
Owner

Originally created by @unicome37 on GitHub (Jan 12, 2026).

Originally assigned to: @adamdotdevin on GitHub.

AbortSignal.timeout() is a new Web API not available in older WebView2. See details below.

[Please copy the content from ISSUE_REPORT.md file]
Bug Report: AbortSignal.timeout is not a function

Summary

OpenCode fails to start on Windows with the error:

TypeError: AbortSignal.timeout is not a function

This occurs because AbortSignal.timeout() is a relatively new Web API that is not available in older WebView2 versions.

Environment

  • OS: Windows
  • OpenCode Version: 1.1.13 (installed from D:\OpenCode\OpenCode.exe)
  • WebView2 Version: [Check with: powershell "Get-ItemProperty 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}' | Select-Object pv"]

Steps to Reproduce

  1. Install OpenCode
  2. Launch OpenCode.exe
  3. Application fails to start with error in console

Error Details

TypeError: AbortSignal.timeout is not a function
    at check (http://tauri.localhost/assets/index-DOiGjfJu.js:1705:38678)
    at run (http://tauri.localhost/assets/index-DOiGjfJu.js:1705:38843)
    at Object.fn (http://tauri.localhost/assets/index-DOiGjfJu.js:1705:38896)
    at runComputation (http://tauri.localhost/assets/index-DOiGjfJu.js:2:8250)
    at updateComputation (http://tauri.localhost/assets/index-DOiGjfJu.js:2:7981)
    at runTop (http://tauri.localhost/assets/index-DOiGjfJu.js:2:9466)
    at runUserEffects (http://tauri.localhost/assets/index-DOiGjfJu.js:2:10730)
    at http://tauri.localhost/assets/index-DOiGjfJu.js:2:10322
    at runUpdates (http://tauri.localhost/assets/index-DOiGjfJu.js:2:9655)
    at completeUpdates (http://tauri.localhost/assets/index-DOiGjfJu.js:2:10315)

The error occurs in the updater plugin's check() function which uses AbortSignal.timeout().

Root Cause

The codebase uses AbortSignal.timeout() in multiple locations:

  • packages/app/src/context/server.tsx
  • packages/app/src/components/dialog-select-server.tsx
  • packages/opencode/src/provider/models.ts
  • packages/opencode/src/provider/provider.ts
  • packages/opencode/src/session/system.ts

This API is only available in:

  • Chrome 103+
  • Node.js 17.3.0+, 16.14.0+
  • WebView2 (older versions don't support it)

Proposed Fix

Add a polyfill for AbortSignal.timeout at the entry point of each package.

Implementation

Create a polyfill file packages/util/src/abort-signal-polyfill.ts:

/**
 * Polyfill for AbortSignal.timeout
 *
 * This API is not available in older WebView2 versions.
 * This polyfill provides a compatible implementation.
 *
 * See: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout_static
 */

if (typeof (AbortSignal as any).timeout !== 'function') {
  (AbortSignal as any).timeout = function(ms: number): AbortSignal {
    const controller = new AbortController();
    setTimeout(() => controller.abort(), ms);
    return controller.signal;
  };
}

Then import it at the top of entry points:

  • packages/desktop/src/index.tsx
  • packages/app/src/index.ts
  • packages/opencode/src/index.ts

Workaround

Users can work around this by:

  1. Upgrading WebView2 to the latest version
  2. Or installing Microsoft Edge (which includes the latest WebView2)

However, a polyfill is the better solution as it ensures compatibility.

Impact

This blocks users from using OpenCode on systems with older WebView2 versions, which is still common on Windows 10/11.

Related

Originally created by @unicome37 on GitHub (Jan 12, 2026). Originally assigned to: @adamdotdevin on GitHub. AbortSignal.timeout() is a new Web API not available in older WebView2. See details below. [Please copy the content from ISSUE_REPORT.md file] Bug Report: AbortSignal.timeout is not a function ## Summary OpenCode fails to start on Windows with the error: ``` TypeError: AbortSignal.timeout is not a function ``` This occurs because `AbortSignal.timeout()` is a relatively new Web API that is not available in older WebView2 versions. ## Environment - **OS**: Windows - **OpenCode Version**: 1.1.13 (installed from `D:\OpenCode\OpenCode.exe`) - **WebView2 Version**: [Check with: `powershell "Get-ItemProperty 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}' | Select-Object pv"`] ## Steps to Reproduce 1. Install OpenCode 2. Launch `OpenCode.exe` 3. Application fails to start with error in console ## Error Details ``` TypeError: AbortSignal.timeout is not a function at check (http://tauri.localhost/assets/index-DOiGjfJu.js:1705:38678) at run (http://tauri.localhost/assets/index-DOiGjfJu.js:1705:38843) at Object.fn (http://tauri.localhost/assets/index-DOiGjfJu.js:1705:38896) at runComputation (http://tauri.localhost/assets/index-DOiGjfJu.js:2:8250) at updateComputation (http://tauri.localhost/assets/index-DOiGjfJu.js:2:7981) at runTop (http://tauri.localhost/assets/index-DOiGjfJu.js:2:9466) at runUserEffects (http://tauri.localhost/assets/index-DOiGjfJu.js:2:10730) at http://tauri.localhost/assets/index-DOiGjfJu.js:2:10322 at runUpdates (http://tauri.localhost/assets/index-DOiGjfJu.js:2:9655) at completeUpdates (http://tauri.localhost/assets/index-DOiGjfJu.js:2:10315) ``` The error occurs in the updater plugin's `check()` function which uses `AbortSignal.timeout()`. ## Root Cause The codebase uses `AbortSignal.timeout()` in multiple locations: - `packages/app/src/context/server.tsx` - `packages/app/src/components/dialog-select-server.tsx` - `packages/opencode/src/provider/models.ts` - `packages/opencode/src/provider/provider.ts` - `packages/opencode/src/session/system.ts` This API is only available in: - Chrome 103+ - Node.js 17.3.0+, 16.14.0+ - WebView2 (older versions don't support it) ## Proposed Fix Add a polyfill for `AbortSignal.timeout` at the entry point of each package. ### Implementation Create a polyfill file `packages/util/src/abort-signal-polyfill.ts`: ```typescript /** * Polyfill for AbortSignal.timeout * * This API is not available in older WebView2 versions. * This polyfill provides a compatible implementation. * * See: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout_static */ if (typeof (AbortSignal as any).timeout !== 'function') { (AbortSignal as any).timeout = function(ms: number): AbortSignal { const controller = new AbortController(); setTimeout(() => controller.abort(), ms); return controller.signal; }; } ``` Then import it at the top of entry points: - `packages/desktop/src/index.tsx` - `packages/app/src/index.ts` - `packages/opencode/src/index.ts` ## Workaround Users can work around this by: 1. Upgrading WebView2 to the latest version 2. Or installing Microsoft Edge (which includes the latest WebView2) However, a polyfill is the better solution as it ensures compatibility. ## Impact This blocks users from using OpenCode on systems with older WebView2 versions, which is still common on Windows 10/11. ## Related - MDN: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout_static - Chrome Platform Status: https://chromestatus.com/feature/5669063187824640
yindo added the windowsweb labels 2026-02-16 17:45:34 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4817