Skip to content

[BUG]: Launching a third OpenCode instance removes the global opencode CLI on Windows #35839

Description

@whilmarbitoco

Environment

  • OS: Windows 10
  • Installation method: npm install -g opencode-ai
  • Shell: WezTerm
  • Package manager: npm

Description

I've been using OpenCode daily for approximately two months without issues.

Recently, I discovered what appears to be a reproducible bug. After launching multiple OpenCode instances, the global opencode command disappears from the system.

This is not just the running process crashing, the executable is no longer available in any terminal until I reinstall the package.

Steps to Reproduce

  1. Install OpenCode:
npm install -g opencode-ai
  1. Verify it works:
opencode
  1. Open a second terminal and start another opencode instance.

  2. Open a third terminal and start a third opencode instance.

  3. The third launch fails, and afterwards the opencode command is no longer recognized anywhere.

Expected Behavior

Launching multiple OpenCode instances should work independently, or fail gracefully if there is a limitation.

The global CLI installation should never be modified or removed.

Actual Behavior

After attempting to launch the third instance:


'opencode' is not recognized as an internal or external command,

operable program or batch file.

Running:

where opencode

returns:


INFO: Could not find files for the given pattern(s).

Additionally:

npm list -g --depth=0

shows:


+-- opencode-ai@

Motice that the version is missing, suggesting the global installation has become corrupted.

The only way to recover is to reinstall:

npm uninstall -g opencode-ai

npm install -g opencode-ai

However, reproducing the same sequence causes the issue again.

Additional Notes

  • This is reproducible on my machine.

  • It only occurs when launching multiple OpenCode processes.

  • The issue appeared after using OpenCode successfully for about two months.

  • I did not update Node.js, npm, or OpenCode immediately before the issue started.

  • My suspicion is that multiple instances may be racing on a self-update, installation, or lockfile operation that affects the global npm installation.

I'd be happy to test a debug build or provide additional logs if needed.

Plugins

None

OpenCode version

1.17.14

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions