Windows: opencode CLI hangs at startup when running internal npm list / npm config get registry #8249

Open
opened 2026-02-16 18:09:31 -05:00 by yindo · 3 comments
Owner

Originally created by @nightmarewalker on GitHub (Feb 1, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

Description

On one Windows 11 machine, OpenCode CLI hangs at startup when it runs internal npm commands.
The process gets stuck while executing npm list, and after manually installing the package,
it proceeds to hang at npm config get registry.

The npm commands themselves work perfectly when executed manually.
The CLI does not crash or show an error — it hangs indefinitely.

This happens consistently on this machine, but another Windows 11 PC with a very similar setup works without any issues.


Reproduction steps

  1. Windows 11

  2. Node.js via fnm (tested with Node v22.22.0, npm v10.9.4)

  3. Run: npx opencode-ai@latest

  4. Confirm installation

  5. CLI hangs during startup (window title shows npm list)

Same behavior also occurs with:

  • winget-installed opencode.exe
  • npm install -g opencode-ai@latest

After global install, the hang progresses to:

npm config get registry


Expected behavior

The CLI should either:

  • start normally, or
  • fail with a visible error message

It should not hang indefinitely during startup.


Observed behavior

  • The CLI hangs silently during startup
  • The window title shows npm list or npm config get registry
  • No error output is shown
  • The process must be terminated manually

Additional investigation results

  • npm list and npm config get registry both exit normally when run manually
  • The issue occurs in:
    • PowerShell 5.1
    • PowerShell 7.4
    • cmd.exe
  • Environment variables such as:
    • NPM_CONFIG_PROGRESS=false
    • FORCE_COLOR=0
      did not change the behavior
  • Desktop version of OpenCode works fine on the same machine
  • The issue reproduces with:
    • winget binary
    • npx
    • global npm install
  • Another Windows 11 PC with a similar setup does not reproduce the issue

Environment

  • OS: Windows 11
  • Node.js: v22.22.0
  • npm: v10.9.4
  • Node manager: fnm
  • Installation methods tested:
    • winget
    • npx
    • npm global install

Notes

This seems related to how the CLI spawns npm processes on Windows during startup checks.
The fact that:

  • npm works correctly when run manually
  • desktop app works
  • the issue occurs across multiple installation methods

suggests a Windows-specific child process / stdio handling issue during npm execution.

Plugins

No response

OpenCode version

1.1.48

Steps to reproduce

Steps to reproduce

  1. Windows 11
  2. Install OpenCode CLI via winget:
    winget install SST.opencode
    
  3. Run
    opencode
    
  4. The CLI hangs during startup (window title shows npm list)

Screenshot and/or share link

No response

Operating System

Windows 11 25H2

Terminal

Windows Terminal

Originally created by @nightmarewalker on GitHub (Feb 1, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description ### Description On one Windows 11 machine, OpenCode CLI hangs at startup when it runs internal npm commands. The process gets stuck while executing `npm list`, and after manually installing the package, it proceeds to hang at `npm config get registry`. The npm commands themselves work perfectly when executed manually. The CLI does not crash or show an error — it hangs indefinitely. This happens consistently on this machine, but **another Windows 11 PC with a very similar setup works without any issues**. --- ### Reproduction steps 1. Windows 11 2. Node.js via fnm (tested with Node v22.22.0, npm v10.9.4) 3. Run: npx opencode-ai@latest 4. Confirm installation 5. CLI hangs during startup (window title shows `npm list`) Same behavior also occurs with: - winget-installed `opencode.exe` - `npm install -g opencode-ai@latest` After global install, the hang progresses to: npm config get registry --- ### Expected behavior The CLI should either: - start normally, or - fail with a visible error message It should not hang indefinitely during startup. --- ### Observed behavior - The CLI hangs silently during startup - The window title shows `npm list` or `npm config get registry` - No error output is shown - The process must be terminated manually --- ### Additional investigation results - `npm list` and `npm config get registry` both exit normally when run manually - The issue occurs in: - PowerShell 5.1 - PowerShell 7.4 - cmd.exe - Environment variables such as: - `NPM_CONFIG_PROGRESS=false` - `FORCE_COLOR=0` did not change the behavior - Desktop version of OpenCode works fine on the same machine - The issue reproduces with: - winget binary - `npx` - global npm install - Another Windows 11 PC with a similar setup does not reproduce the issue --- ### Environment - OS: Windows 11 - Node.js: v22.22.0 - npm: v10.9.4 - Node manager: fnm - Installation methods tested: - winget - npx - npm global install --- ### Notes This seems related to how the CLI spawns npm processes on Windows during startup checks. The fact that: - npm works correctly when run manually - desktop app works - the issue occurs across multiple installation methods suggests a Windows-specific child process / stdio handling issue during npm execution. ### Plugins _No response_ ### OpenCode version 1.1.48 ### Steps to reproduce ### Steps to reproduce 1. Windows 11 2. Install OpenCode CLI via winget: ```powershell winget install SST.opencode ``` 3. Run ```powershell opencode ``` 4. The CLI hangs during startup (window title shows npm list) ### Screenshot and/or share link _No response_ ### Operating System Windows 11 25H2 ### Terminal Windows Terminal
yindo added the windowsbugperf labels 2026-02-16 18:09:31 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 1, 2026):

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

  • #9870: Windows: opencode freezes before TUI — missing fast-deep-equal dependency in cached node_modules
  • #10819: [Bug] Windows: Cannot find package 'fast-deep-equal' when running auth login
  • #8233: Windows: opencode prints help and exits for any command. Desktop GUI fails to spawn server
  • #8117: OpenCode Desktop 1.1.15 hangs on 'Initializing…' (Windows 11 ARM64)
  • #8144: OpenCode.exe (Windows x64) hangs indefinitely at 'Initializing...' with no debug logs
  • #8108: once update to 1.1.15 keep initializing...

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

@github-actions[bot] commented on GitHub (Feb 1, 2026): This issue might be a duplicate of existing issues. Please check: - #9870: Windows: opencode freezes before TUI — missing fast-deep-equal dependency in cached node_modules - #10819: [Bug] Windows: Cannot find package 'fast-deep-equal' when running auth login - #8233: Windows: opencode prints help and exits for *any* command. Desktop GUI fails to spawn server - #8117: OpenCode Desktop 1.1.15 hangs on 'Initializing…' (Windows 11 ARM64) - #8144: OpenCode.exe (Windows x64) hangs indefinitely at 'Initializing...' with no debug logs - #8108: once update to 1.1.15 keep initializing... Feel free to ignore if none of these address your specific case.
Author
Owner

@nightmarewalker commented on GitHub (Feb 5, 2026):

Additional investigation results:

This issue is reproducible on OpenCode v1.1.51.

Using opencode --print-logs, I found that the hang is NOT caused by npm, fnm, or TTY.

OpenCode fails during interactive UI initialization:

Failed to initialize OpenTUI render library
Failed to open library:
B:/~BUN/root/opentui-xxxxxxxx.dll
error code 126

Observed behavior based on execution mode:

  • opencode → hangs during startup
  • opencode run <prompt> → works normally

Additional environment notes:

  • Node is managed via fnm
  • npm works normally when executed directly
  • node -e "console.log(process.stdin.isTTY, process.stdout.isTTY)" returns true true
  • npm list completes normally when run manually
  • Issue reproduces only on one Windows machine
  • Another Windows PC with a similar fnm/Node setup does NOT reproduce the issue

This suggests the failure occurs during OpenTUI initialization on Windows rather than during npm execution.

@nightmarewalker commented on GitHub (Feb 5, 2026): Additional investigation results: This issue is reproducible on **OpenCode v1.1.51**. Using `opencode --print-logs`, I found that the hang is NOT caused by npm, fnm, or TTY. OpenCode fails during interactive UI initialization: ``` Failed to initialize OpenTUI render library Failed to open library: B:/~BUN/root/opentui-xxxxxxxx.dll error code 126 ``` Observed behavior based on execution mode: * `opencode` → hangs during startup * `opencode run <prompt>` → works normally Additional environment notes: * Node is managed via fnm * npm works normally when executed directly * `node -e "console.log(process.stdin.isTTY, process.stdout.isTTY)"` returns `true true` * `npm list` completes normally when run manually * Issue reproduces only on one Windows machine * Another Windows PC with a similar fnm/Node setup does NOT reproduce the issue This suggests the failure occurs during OpenTUI initialization on Windows rather than during npm execution.
Author
Owner

@nightmarewalker commented on GitHub (Feb 15, 2026):

Additional findings (interactive UI loading)

I have upgraded to the latest CLI version (v1.2.4) and the issue still reproduces.

Using opencode --print-logs, the hang is not related to npm or node execution, but rather occurs during interactive UI initialization:

ERROR Failed to initialize OpenTUI render library:
Failed to open library "B:/~BUN/root/opentui-xxxxxxxx.dll": error code 126

error code 126 is the Windows loader error for “module or dependency could not be loaded”.
This error appears immediately on startup and no further logs are produced.

Observed behavior:

  • Interactive launch (opencode) never progresses past this error.
  • Non-interactive mode (opencode run <prompt>) works normally and does not trigger this failure.
  • Manual npm list, npm config, and other npm commands execute successfully outside of the CLI.
  • node -e "console.log(process.stdin.isTTY, process.stdout.isTTY)" prints true true.
  • This issue only reproduces on this specific Windows environment; another Windows PC with similar Node/fnm setup does NOT exhibit this problem.

The failure clearly occurs at the point where OpenCode attempts to load the native OpenTUI DLL from a Bun-resolved path (e.g. B:/~BUN/root/...).

This issue persists through versions v1.1.49 up through v1.2.4.

@nightmarewalker commented on GitHub (Feb 15, 2026): ### Additional findings (interactive UI loading) I have upgraded to the latest CLI version (`v1.2.4`) and the issue **still reproduces**. Using `opencode --print-logs`, the hang is **not related to npm or node execution**, but rather occurs during interactive UI initialization: ERROR Failed to initialize OpenTUI render library: Failed to open library "B:/~BUN/root/opentui-xxxxxxxx.dll": error code 126 `error code 126` is the Windows loader error for “module or dependency could not be loaded”. This error appears immediately on startup and no further logs are produced. Observed behavior: - Interactive launch (`opencode`) never progresses past this error. - Non-interactive mode (`opencode run <prompt>`) works normally and does not trigger this failure. - Manual `npm list`, `npm config`, and other npm commands execute successfully outside of the CLI. - `node -e "console.log(process.stdin.isTTY, process.stdout.isTTY)"` prints `true true`. - This issue only reproduces on this specific Windows environment; another Windows PC with similar Node/fnm setup does NOT exhibit this problem. The failure clearly occurs at the point where OpenCode attempts to load the native OpenTUI DLL from a Bun-resolved path (e.g. `B:/~BUN/root/...`). This issue persists through versions v1.1.49 up through v1.2.4.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8249