OpenCode crashes when installDependencies runs despite existing node_modules #6613

Open
opened 2026-02-16 18:04:45 -05:00 by yindo · 1 comment
Owner

Originally created by @liorshk on GitHub (Jan 17, 2026).

Originally assigned to: @rekram1-node on GitHub.

Bug

OpenCode starts a background install even when dependencies already exist, causing standalone binaries to invoke themselves as the Bun runtime and crash.

Steps to reproduce

  1. Run OpenCode standalone binary in an environment where process.execPath points to the binary (typical packaged binary).
  2. Ensure /tmp/config/opencode/node_modules exists.
  3. Start OpenCode.

Expected

No install is kicked off if node_modules already exists.

Actual

installDependencies() is invoked unconditionally, triggering a bun add in the background, which can crash the binary and cause a restart loop.

Proposed fix

Only call installDependencies when node_modules is missing.

Originally created by @liorshk on GitHub (Jan 17, 2026). Originally assigned to: @rekram1-node on GitHub. ## Bug OpenCode starts a background install even when dependencies already exist, causing standalone binaries to invoke themselves as the Bun runtime and crash. ## Steps to reproduce 1. Run OpenCode standalone binary in an environment where process.execPath points to the binary (typical packaged binary). 2. Ensure /tmp/config/opencode/node_modules exists. 3. Start OpenCode. ## Expected No install is kicked off if node_modules already exists. ## Actual installDependencies() is invoked unconditionally, triggering a bun add in the background, which can crash the binary and cause a restart loop. ## Proposed fix Only call installDependencies when node_modules is missing.
Author
Owner

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

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

  • #8729: Disable force dependency update while starting
  • #4682: opencode get stuck when bun add get stuck
  • #7911: Wrapper script trying to execute native binary with Node.js if installed by pnpm
  • #6765: Infinite installation loop of @aws-sdk/credential-providers on startup when AWS_BEARER_TOKEN_BEDROCK is set

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

@github-actions[bot] commented on GitHub (Jan 17, 2026): This issue might be a duplicate of existing issues. Please check: - #8729: Disable force dependency update while starting - #4682: opencode get stuck when `bun add` get stuck - #7911: Wrapper script trying to execute native binary with Node.js if installed by pnpm - #6765: Infinite installation loop of @aws-sdk/credential-providers on startup when AWS_BEARER_TOKEN_BEDROCK is set Feel free to ignore if none of these address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#6613