Windows: opencode freezes before TUI — missing fast-deep-equal dependency in cached node_modules #7100

Open
opened 2026-02-16 18:06:11 -05:00 by yindo · 2 comments
Owner

Originally created by @Luke-G3458 on GitHub (Jan 21, 2026).

Originally assigned to: @thdxr on GitHub.

Description

Summary

On Windows, opencode freezes before the TUI appears. Logs show repeated module resolution failures for fast-deep-equal inside the extracted Node.js dependencies under ~\.cache\opencode. The backend server starts but fails every request, causing the TUI to block indefinitely.

Clearing the cache and reinstalling does not resolve the issue. However, manually installing the missing dependency inside the extracted cache does unblock opencode and allows the TUI to load.

This appears to be a Windows-specific dependency packaging or extraction issue.


Environment

  • OS: Windows 11

  • Shells tested:

    • PowerShell

    • Command Prompt

    • WezTerm

  • Installation method:

    • npm global install
  • opencode version: 1.1.29

  • Node version: bundled with opencode

macOS coworker is able to run the same opencode version without issue.


Reproduction steps

  1. Install opencode
npm install -g opencode
  1. Run:
opencode
  1. Observe:

    • No TUI appears

    • Terminal becomes unresponsive (Ctrl-C does not exit)

  2. Capture logs:

opencode > out.txt 2>&1

Observed behavior

  • Internal HTTP server starts

  • Repeated requests to:

    • /session

    • /config

    • /config/providers

    • /provider

    • /agent

  • Every request fails due to a missing Node dependency

  • TUI never initializes and the process appears frozen


Error logs

ERROR service=default e={
  "name":"ResolveMessage",
  "message":"Cannot find package 'fast-deep-equal' from
  'C:\\Users\\<user>\\.cache\\opencode\\node_modules\\find-my-way\\index.js'",
  "specifier":"fast-deep-equal",
  "importKind":"require-call",
  "referrer":"C:\\Users\\<user>\\.cache\\opencode\\node_modules\\find-my-way\\index.js"
} exception

This error repeats for every backend request.


Expected behavior

  • opencode should:

    • correctly extract all required Node dependencies on Windows, or

    • fail fast with a clear, user-facing error

  • The TUI should not hang indefinitely if the backend fails to initialize


Troubleshooting attempted

  • Deleted C:\Users\<user>\.cache\opencode

  • Reinstalled opencode

  • Rebooted

  • Tried multiple terminals

  • Redirected logs to file

  • Ctrl-C does not terminate the frozen process

None of these resolved the issue.

Confirmed workaround (manual dependency install)

Manually installing the missing dependency into the extracted cache allows opencode to start successfully and the TUI to appear.

Steps:

cd $env:USERPROFILE\.cache\opencode\node_modules\find-my-way
npm install fast-deep-equal

After this:

opencode

✔️ TUI loads correctly
✔️ Backend requests succeed

This strongly suggests the dependency is missing from the bundled or extracted Node environment on Windows.


Suspected root cause

  • find-my-way depends on fast-deep-equal

  • The dependency is missing from opencode’s extracted node_modules

  • Possible contributing factors:

    • incomplete bundling of transitive dependencies

    • Windows extraction / path-length issues

    • cache reuse across versions

    • antivirus interference during extraction


Suggested improvements

  • Explicitly bundle fast-deep-equal (and other transitive deps)

  • Validate Node dependency integrity at startup

  • Fail fast with a clear error instead of blocking the TUI

  • Consider bundling JS with esbuild/rollup to avoid runtime dependency resolution

Plugins

N/A

OpenCode version

1.1.29

Steps to reproduce

  1. Install opencode
npm install -g opencode
  1. Run:
opencode
  1. Observe:

    • No TUI appears

    • Terminal becomes unresponsive (Ctrl-C does not exit)

  2. Capture logs:

opencode > out.txt 2>&1

Screenshot and/or share link

No response

Operating System

Windows 11

Terminal

Powershell, cmd, wezterm

Originally created by @Luke-G3458 on GitHub (Jan 21, 2026). Originally assigned to: @thdxr on GitHub. ### Description ### Summary On Windows, `opencode` freezes before the TUI appears. Logs show repeated module resolution failures for `fast-deep-equal` inside the extracted Node.js dependencies under `~\.cache\opencode`. The backend server starts but fails every request, causing the TUI to block indefinitely. Clearing the cache and reinstalling does not resolve the issue. However, manually installing the missing dependency inside the extracted cache does unblock opencode and allows the TUI to load. This appears to be a Windows-specific dependency packaging or extraction issue. --- ### Environment - OS: Windows 11 - Shells tested: - PowerShell - Command Prompt - WezTerm - Installation method: - npm global install - opencode version: `1.1.29` - Node version: bundled with opencode macOS coworker is able to run the same opencode version without issue. --- ### Reproduction steps 1. Install opencode ```bash npm install -g opencode ``` 2. Run: ```bash opencode ``` 3. Observe: - No TUI appears - Terminal becomes unresponsive (Ctrl-C does not exit) 4. Capture logs: ```bash opencode > out.txt 2>&1 ``` --- ### Observed behavior - Internal HTTP server starts - Repeated requests to: - `/session` - `/config` - `/config/providers` - `/provider` - `/agent` - Every request fails due to a missing Node dependency - TUI never initializes and the process appears frozen --- ### Error logs ``` ERROR service=default e={ "name":"ResolveMessage", "message":"Cannot find package 'fast-deep-equal' from 'C:\\Users\\<user>\\.cache\\opencode\\node_modules\\find-my-way\\index.js'", "specifier":"fast-deep-equal", "importKind":"require-call", "referrer":"C:\\Users\\<user>\\.cache\\opencode\\node_modules\\find-my-way\\index.js" } exception ``` This error repeats for every backend request. --- ### Expected behavior - opencode should: - correctly extract all required Node dependencies on Windows, or - fail fast with a clear, user-facing error - The TUI should not hang indefinitely if the backend fails to initialize --- ### Troubleshooting attempted - Deleted `C:\Users\<user>\.cache\opencode` - Reinstalled opencode - Rebooted - Tried multiple terminals - Redirected logs to file - Ctrl-C does not terminate the frozen process None of these resolved the issue. ### Confirmed workaround (manual dependency install) Manually installing the missing dependency into the extracted cache allows opencode to start successfully and the TUI to appear. Steps: ```powershell cd $env:USERPROFILE\.cache\opencode\node_modules\find-my-way npm install fast-deep-equal ``` After this: ```powershell opencode ``` ✔️ TUI loads correctly ✔️ Backend requests succeed This strongly suggests the dependency is missing from the bundled or extracted Node environment on Windows. --- ### Suspected root cause - `find-my-way` depends on `fast-deep-equal` - The dependency is missing from opencode’s extracted node_modules - Possible contributing factors: - incomplete bundling of transitive dependencies - Windows extraction / path-length issues - cache reuse across versions - antivirus interference during extraction --- ### Suggested improvements - Explicitly bundle fast-deep-equal (and other transitive deps) - Validate Node dependency integrity at startup - Fail fast with a clear error instead of blocking the TUI - Consider bundling JS with esbuild/rollup to avoid runtime dependency resolution ### Plugins N/A ### OpenCode version 1.1.29 ### Steps to reproduce 1. Install opencode ```bash npm install -g opencode ``` 2. Run: ```bash opencode ``` 3. Observe: - No TUI appears - Terminal becomes unresponsive (Ctrl-C does not exit) 4. Capture logs: ```bash opencode > out.txt 2>&1 ``` ### Screenshot and/or share link _No response_ ### Operating System Windows 11 ### Terminal Powershell, cmd, wezterm
yindo added the windowsbug labels 2026-02-16 18:06:11 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 21, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #9304: Windows - Cannot find package 'reusify' (similar missing dependency issue in cached node_modules)
  • #9106: OpenCode crashes when installDependencies runs despite existing node_modules (related to node_modules cache handling)

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 21, 2026): This issue might be a duplicate of existing issues. Please check: - #9304: Windows - Cannot find package 'reusify' (similar missing dependency issue in cached node_modules) - #9106: OpenCode crashes when installDependencies runs despite existing node_modules (related to node_modules cache handling) Feel free to ignore if none of these address your specific case.
Author
Owner

@MoerAI commented on GitHub (Jan 27, 2026):

Root Cause Analysis

I investigated this issue and found the root cause:

Why --linker=isolated doesn't work

Bun's --linker=isolated option still stores packages in the .bun folder and creates symlinks (ReparsePoints on Windows) in node_modules. CommonJS require() resolution doesn't follow these Windows symlinks correctly.

Solution: --backend=copyfile

Using --backend=copyfile instead of --linker=isolated fixes the issue:

bun add --backend=copyfile @gitlab/opencode-gitlab-auth@1.3.2

This creates actual file copies instead of symlinks, which CommonJS can resolve correctly.

Test Results

  1. With default bun: fast-deep-equal not found
  2. With --linker=isolated: packages in .bun folder with symlinks, still fails
  3. With --backend=copyfile: real directories, require() works ✓

Proposed Fix

Change in packages/opencode/src/bun/index.ts:

const args = [
  add,
  --force,
  --exact,
  --backend=copyfile,  // Use copyfile instead of symlinks
  ...
]

I'll submit a PR with this fix.

@MoerAI commented on GitHub (Jan 27, 2026): ## Root Cause Analysis I investigated this issue and found the root cause: ### Why `--linker=isolated` doesn't work Bun's `--linker=isolated` option still stores packages in the `.bun` folder and creates symlinks (ReparsePoints on Windows) in `node_modules`. CommonJS `require()` resolution doesn't follow these Windows symlinks correctly. ### Solution: `--backend=copyfile` Using `--backend=copyfile` instead of `--linker=isolated` fixes the issue: ```bash bun add --backend=copyfile @gitlab/opencode-gitlab-auth@1.3.2 ``` This creates actual file copies instead of symlinks, which CommonJS can resolve correctly. ### Test Results 1. With default bun: `fast-deep-equal` not found ❌ 2. With `--linker=isolated`: packages in `.bun` folder with symlinks, still fails ❌ 3. With `--backend=copyfile`: real directories, `require()` works ✓ ### Proposed Fix Change in `packages/opencode/src/bun/index.ts`: ```typescript const args = [ add, --force, --exact, --backend=copyfile, // Use copyfile instead of symlinks ... ] ``` I'll submit a PR with this fix.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7100