Skip to content

cli: plugin add with Git spec fails with "git dep preparation failed" #55073

Closed as duplicate

Description

@Okxdd123

Summary

opencode plugin add with any Git package spec fails with
NpmInstallFailedError caused by Error: git dep preparation failed,
although the V2 docs list Git specs (github:, HTTPS, SSH) as supported.
This blocks GitHub-only plugin distribution (no npm account needed).

Environment

  • opencode version: v2.0.28 (also reproduced on v2.0.27)
  • OS: Darwin 27.2.0 arm64
  • Terminal: iTerm.app, xterm-256color, truecolor
  • Shell: /bin/zsh
  • Install/channel: release, via anomalyco/tap/opencode-v2 (homebrew)
  • Active plugins: none relevant (failure happens during install, before load)

Reproduction

  1. opencode plugin add 'github:Okxdd123/opencode-terminal-status#v1.0.0'
    (also tried github:Okxdd123/opencode-terminal-status and
    git+https://github.com/Okxdd123/opencode-terminal-status.git#v1.0.0)
  2. Observe the failure below:
NpmInstallFailedError:
    at catch (/$bunfs/root/chunk-apxtfw24.js:3:6393)
    at Npm.reify (/$bunfs/root/chunk-apxtfw24.js:3:6432)
    at Npm.add (/$bunfs/root/chunk-zy1hnpwh.js:2:1447)
    at Npm.add (definition) (/$bunfs/root/chunk-apxtfw24.js:3:8131)
    at cli.plugin.add (/$bunfs/root/chunk-s4zsbqev.js:7:21270)
    at cli.plugin.add (definition) (/$bunfs/root/chunk-zy1hnpwh.js:2:1259) {
  [cause]: Error: git dep preparation failed
      at yt (/$bunfs/root/chunk-1x9pd0k1.js:8:4481)
      at processTicksAndRejections (native:7:39)
}

Control experiments on the same machine:

  • git ls-remote https://github.com/Okxdd123/opencode-terminal-status.git
    lists refs fine (repo + v1.0.0 tag exist and are public).
  • bun add 'github:Okxdd123/opencode-terminal-status#v1.0.0' in an empty
    dir succeeds (package downloads and installs).
  • No proxy env vars; both github.com:443 and :22 reachable
    (ssh answers, only key auth missing as expected).

The test repo is a minimal plugin package (package.json with . and
./tui exports, committed dist/): no install scripts, no dependencies.

Expected Behavior

Per https://opencode.ai/v2/docs/plugins/ ("Package installation accepts
npm names … plus npm-compatible Git package specifications … opencode plugin add github:acme/opencode-plugin"), the Git spec installs the
package.

Actual Behavior

All Git spec forms fail identically with git dep preparation failed,
with no further detail even under OPENCODE_LOG_LEVEL=DEBUG.

Additional Context

  • Consistent failure, reproduced on 2.0.27 and 2.0.28.
  • Workaround: manual git clone into the plugins directory works, so
    this is specifically the plugin add Git path.

Activity

  1. opencode-agent commented on Oct 13, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed report and the control experiments, they made this easy to trace.

    I think this is a duplicate of #49704. Your repo's package.json has a "build" script. During a Git install, npm's git fetcher sees a build, prepare or install-type script (or workspaces) and runs an extra "preparation" install. Inside the compiled opencode binary that step fails with exactly git dep preparation failed. Packages without those scripts install fine from the same host, and bun add doesn't take that path, which is why it worked for you.

    Possible duplicates and related issues, ordered by likelihood:

    Until it's fixed, there's a workaround: since you already commit dist/, rename the script in your published tag (for example "build" → "build:dist") so the preparation step isn't triggered. The vercel-plugin maintainers did the same thing.

    The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.

  2. Okxdd123 commented on Oct 13, 2026

    @Okxdd123
    Author

    Workaround confirmed — renaming the build script to build:dist fixed the Git install on 2.0.28. Thanks for the quick diagnosis! Closing as a duplicate of #49704.

  3. opencode-agent commented on Oct 13, 2026

    @opencode-agent
    Contributor

    Thanks for confirming! Glad renaming the script to build:dist got the Git install working on 2.0.28. That confirms this is the same problem as #49704, so please follow that issue for the actual fix. The bot will close this one as a duplicate.

  4. opencode-agent commented on Oct 14, 2026

    @opencode-agent
    Contributor

    Closing this as a duplicate of #49704, as you agreed. The git dep preparation failed error comes from the build script in a Git plugin package, and renaming it to build:dist works around it. Please follow #49704 for the actual fix. Thanks again for the clear report and for confirming the workaround!

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions